if ($_POST[op] != "ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST[op] == "ds") {
// check value of $_POST[lastname]
if ($_POST[lastname] == "") {
$name_err = "Please enter your name!
";
$send = "no";
}
// check value of $_POST[E-mail]
if ($_POST[E-mail] == "") {
$email_err = "Please enter your
e-mail address!
";
$send = "no";
}
// check value of $_POST[message]
if ($_POST[message]== "") {
$message_err = "Please enter a message!
";
$send = "no";
}
if ($send != "no") {
// it's ok to send, so build the mail
$msg = "E-MAIL SENT FROM WWW SITE\n";
$msg .= "Sender's Name:\t$_POST[firstname]\n";
$msg .= "Sender's Name:\t$_POST[lastname]\n";
$msg .= "Birthday:\t$_POST[pets_name]\n";
$msg .= "Country:\t$_POST[country]\n";
$msg .= "Zip code:\t$_POST[zip]\n";
$msg .= "Telephone No. :\t$_POST[telephone]\n";
$msg .= "Message:\t$_POST[message]\n\n";
//set up the mail
$recipient = "mpweinstein@hotmail.com";
$subject = "Form Submission Results";
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/html; charset=ISO-8859-1\r\n";
$mailheaders .= "From: My Web Site \n";
$mailheaders .= "Reply-To: ".$_POST["email"];
//display confirmation to user
echo "Mail has been sent!
";
} else if ($send == "no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>