$value) {
${'CNV_' . $key} = trim(htmlspecialchars($value));
//echo "
" . ${'CNV_' . $key}; // show values for debugging
};
// -- convert POST variables to local variables; add prefix to avoid spoofing --
// ++ validate personal details ++
$err_text = "";
if (strlen(stripslashes($CNV_name)) < 2) $err_text = ' Name missing or too short. ';
if (strlen(stripslashes($CNV_company)) < 2) $err_text .= ' Company name missing or too short. ';
if (strlen(stripslashes($CNV_telephone)) < 8) $err_text .= ' Telephone number missing or too short. ';
if (strlen($CNV_email) == 0) {
$err_text .= 'Email address missing.';
} elseif (!eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes($CNV_email))) {
$err_text .= 'Invalid email address. ';
} elseif ($CNV_email <> $CNV_email) {
$err_text .= 'Email addresses do not match. ';
};
// -- validate personal details --
if ($err_text == "") {
// mail Scott
ini_set('sendmail_from','response@toothbone.co.uk');
$to = 'response@toothbone.co.uk';
$subject = 'Message via response form on web site contact page';
$message = '';
$message .= $CNV_name;
$message .= "\r\n";
$message .= $CNV_position;
$message .= "\r\n";
$message .= $CNV_company;
$message .= "\r\n";
$message .= $CNV_telephone;
$message .= "\r\n";
$message .= $CNV_email;
$message .= "\r\n";
$message .= $CNV_message;
$message .= "\r\n";
$message .= "\r\n";
if (isset($CNV_opt)) {$message .= "optin was ticked";} else {$message .= "optin was NOT ticked";};
$headers = "";
$headers .= "Reply-to: response@toothbone.co.uk\r\n";
$headers .= "Return-Path: response@toothbone.co.uk\r\n";
mail($to, $subject, $message, $headers);
include 'contactus_header.htm';
echo "
Thank you for your message. We will contact you shortly.