Send an email to Tolly-Ho
[/code]
[code lang="PHP"]
You have not entered a name.\n";
$problem = TRUE;
$name="";
}
if ($lenFrom==0)
{
echo "
You have not entered an email address.
\n";
$problem = TRUE;
$from="";
}
if ($lenComment==0)
{
echo "
You have not entered a comment.
\n";
$problem = TRUE;
$comment="";
}
if ($problem == FALSE)
{
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "
Invalid email address.
\n";
$problem=TRUE;
}
}
if ($problem == TRUE)
{
echo "
";
}
else
{
$fields = array();
$fields{"name"} = "Name";
$fields{"email"} = "Email";
$fields{"comment"} = "Message";
$body = "The following message has been generated via the web form on www.tollyho.com/contactus.htm:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: info@tollyho.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting Tolly-Ho Restaurant. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.tollyho.com or call us directly at 859-253-2007.\n\nHere is a copy of your email:\n\n"; foreach($fields as $a => $b){ $autoreply .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
}
if($send){echo "
Your email has been sent.
"; }
//else {echo "
We encountered an error sending your mail, please email us directly to info@tollyho.com
"; }
?>
[/code]
[code lang="HTML"]