<?
$a = addslashes($_GET['a']);
if($a == "quickcontact"){
$email = addslashes($_POST['email']);
$message = nl2br($_POST['message']);
$captchaword = addslashes($_POST['captchaword']);
$captchanum = addslashes($_POST['captchanum']);
if((!$email) or (!$captchaword)){
?>
<p class="red">Oops! You missed a required field. Please try again.</p>
<?include('quickcontactform.php');
} else {
$captchawords = array("word1", "word2", "word3", "word4", "word5", "word6");
$captchanumbers = array("1", "2", "3", "4", "5", "6");
$captchaconverted = str_replace($captchawords, $captchanumbers, $captchaword);
if($captchaconverted != $captchanum){
?>
<p class="red">Oops! The word you entered to match the image was incorrect. Please try again.</p>
<?include('quickcontactform.php');
} else {
$to = "$name <$email>";
$from = "You <[email protected]>";
$subject = "Quick Contact";
$message = "HTML email content here";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $from\r\n";
$headers .= "Cc: [email protected]";
if(mail($to, $subject, $message, $headers)){
?>
<p><strong>Thank you for getting in contact with us.</strong></p><p>We should get back to you within 24 hours, but if not or if your enquiry is urgent then please call us on 0800 555 555.</p>
<?
} else {
?>
<p class="red">Oops!</p><p>An error occured when trying to send your message. Please try again, or if the problem persits, please call 0800 555 555.</p>
<?
include('quickcontactform.php');
}
}
}
} else {
include('quickcontactform.php');
}
?>