Forum Moderators: coopster
<?php
/* Set e-mail recipient */
$myemail = "cj@shaw.ca , $rep";
/* Customers info */
$rep = check_input($_POST['rep']);
$name = check_input($_POST['name']);
$address = check_input($_POST['addrees']);
$account = check_input($_POST['account']);
$contactnumber = check_input($_POST['contactnumber']);
$id1 = check_input($_POST['id1']);
$id2 = check_input($_POST['id2']);
$installdate = check_input($_POST['installdate']);
$othernotes = check_input($_POST['othernotes']);
/* SDP */
$port = check_input($_POST['port']);
$mtsbill = check_input($_POST['mtsbill']);
$port = check_input($_POST['port']);
$phonebook = check_input($_POST['phonebook']);
$listedas = check_input($_POST['listedas']);
$listednoaddress = check_input($_POST['listednoaddress']);
$alarm = check_input($_POST['alarm']);
$sdpnotes = check_input($_POST['sdpnotes']);
/* Television */
$television = check_input($_POST['television']);
/* Internet */
$internet = check_input($_POST['internet']);
$subject = "Shaw Workorder: $address"
/* Let's prepare the message for the e-mail */
$message = "Work Order
Reps Email: $rep
Customers Info:
Name: $name
Address: $address
Contact Number: $contactnumber
Account Number: $account
ID #1: $id1
ID #2: $id2
Digital Phone:
Port or New Number: $port
Name on Phone Bill: $mtsbill
Name in Phonebook: $phonebook
Listed as: $listedas
Listed Without Address? $listednoaddress
Alarm Company: $alarm
Digital Phone Notes: $sdpnotes
Television:
$television
Internet:
$internet
Requesting Instal Date of: $installdate
Other Notes: $othernotes
";
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
header('Location: submitted.htm');
exit();
/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>