CONTACT
// BEGIN FORM
global $submit;
if (!$submit)
{
?>
}
else {
// set up error list array
$errorList = array();
$count = 0;
// validate text input fields
if (!$name) { $errorList[$count] = "Required Field: Name"; $count++; }
if (!$email) { $errorList[$count] = "Required Field: E-mail Address"; $count++; }
if (!(ereg("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))){ $errorList[$count] = "E-mail Address does not appear to be valid"; $count++; }
// if none found...
if (sizeof($errorList) == 0){
$date=date("F d, Y");
$message="Name: ". $name .
"\n Phone: ". $phone .
"\n Email: ". $email .
"\n Message: ".$comments.
"\n Date Sent: ".$date.
"\n\n";
// REMOVE STUFF //
$message=ereg_replace('[*<>#%]+','',$message);
// SEND MAIL //
$subject = "Online Contact Form";
$sendto = "[email protected], [email protected]";
$header = "From: $email";
mail($sendto, $subject, $message, $header);
// REMOVE STUFF //
$name=ereg_replace('[*<>#%]+','',$name);
$phone=ereg_replace('[*<>#%]+','',$phone);
$email=ereg_replace('[*<>#%]+','',$email);
$howhear=ereg_replace('[*<>#%]+','',$howhear);
$comments=ereg_replace('[*<>#%]+','',$comments);
?>
Thank You. The following information has been submitted to Coldren Construction |
Name: echo $name ;?> |
Telephone: echo $phone ;?> |
Email: echo $email ;?> |
Message: echo $comments ;?> |
}
else
{
?>
// errors occurred
// print as list
echo "
Please press your BACK button and correct the following form fields: ";
echo "";
for ($x=0; $x$errorList[$x]";
}
echo " ";
}
?>
|
}
?>
|
|