extract($_POST);
if(isset($send_form)) {
$empty_fields="";
$errors=0;
// empty field checking
function valid_email($email) {
if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)){
return true;
}else{
return false;
}
}
if ($name == ""){
$errors++;
$empty_fields[] .= "name";
}
// email Validation
if (valid_email($email)==false) {
$errors++;
print "
Please enter a valid email so that you'll be able to be reached quickly
\n";
}
if ($errors == 0) {
// Sends e-mail
$recipient .= "ewaite@thewaitegroup.com";
$subject = "Lawn Care Contact";
$message .= "name: ".$name."\n"."streetaddress: ".$streetaddress."\n"."city: ".$city."\n"."state: ".$state."\n"."zip: ".$zip."\n"."home_phone: ".$home_phone."\n"."email: ".$email."\n"."comments: ".$comments."\n";
if($parts != "") {
$message .= "\nParts requested:\n";
for($i=0; $i
Couldn't send e-mail. Please go back on your browser, and try again.\n";
}
else {
// Print Thank You Page
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://www.thewaitegroup.com/edslawncare/thank_you.html');
}
}
else {
print "We are missing some information. Please go back and fill in the following fields:
\n\n\n";
while($each_error = each($empty_fields)) {
print "\t- ".$each_error[value]."
\n";
}
print "
\n";
}
}
else { ?>