Contact Us
An error has occured with the spam prevention code';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!$name) {
$errorName = true;
$error_message .= 'You did not enter your name. ';
}
elseif(!preg_match($string_exp,$name)) {
$errorName = true;
$error_message .= 'The Name you entered does not appear to be valid. ';
}
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!$email_from) {
$errorEmail = true;
$error_message .= 'You did not enter your email address. ';
}
elseif(!preg_match($email_exp,$email_from)) {
$errorEmail = true;
$error_message .= 'The email address you entered does not appear to be valid. ';
}
if(strlen($comments) < 10) {
$errorComment = true;
$error_message .= 'You comment was too short. ';
}
if(empty($_SESSION['security_number'])) {
$errorSubmitted = true;
$error_message .= 'This for has already been submitted. ';
}
elseif(!$captcha) {
$errorCaptcha = true;
$error_message .= 'You did not enter the spam prevention security code ';
}
elseif( $security_number != $captcha ) {
$errorCaptcha = true;
$error_message .= 'The spam prevention security code you entered was incorrect ';
}
elseif( ($security_number == $captcha) && !$error_message ) {
$_SESSION['security_number'] = '';
$email_message = "Your Contact Form details are below.\n\n";
$email_message .= "Name: " .clean_string($name)."\n";
$email_message .= "Email: " .clean_string($email_from)."\n";
$email_message .= "Telephone: " .clean_string($telephone)."\n";
$email_message .= "Comments: " .clean_string($comments)."\n";
$email_header = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $email_header);
echo '';
$mailSent = true;
}
if($error_message) {
echo '
Your message was successfully sent
';
if(!isset($errorSubmitted)) {
echo '
';
}
}
if(!isset($mailSent))
{
if(!isset($errorSubmitted))
{
?>
All the required fields were not filled out correctly.
Please correct them and submit the contact form again.
- '.$error_message.'
You have already submitted this form