Hi all,
After spending 2 days going through this code, going through search engines and endless forums trying to find a solution, i find myself still on Square 1. Therefore just before I begin hitting my head against the wall (have pity on the poor wall) I thought I'd give this forum a go hoping that someone might be able to help me find what is wrong with this code:
Sincerely appreciate your time and assistance.
Thank you
The error message I receive is:
Parse error: syntax error, unexpected $end in /home/zincom/public_html/hf/contactformprocess.php on line 76
The code I have is:
<?php
if(isset($_POST['info@xxxxxxxxxx'])) {
include 'contactformsettings.php';
function died($error) {
echo "Sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please complete all fields.<br /><br />";
die();
}
if(!isset($_POST['Name']) ||
!isset($_POST['Email']) ||
!isset($_POST['Phone']) ||
!isset($_POST['Enquiry']) ||
!isset($_POST['AntiSpam'])
) {
died('Sorry, there appears to be a problem with your form submission.');
}
$full_name = $_POST['Name']; // required
$email_from = $_POST['Email']; // required
$telephone = $_POST['Phone']; // required
$comments = $_POST['Enquiry']; // required
$antispam = $_POST['AntiSpam']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(preg_match($email_exp,$email_from)==0) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
if(strlen($name) < 2) {
$error_message .= 'Please enter your name.<br />';
if(strlen($phone) < 2) {
$error_message .= 'Please enter your phone number.<br />';
}
if(strlen($enquiry) < 2) {
$error_message .= 'Please enter details of your enquiry.<br />';
}
if($antispam <> $antispam_answer) {
$error_message .= 'The Anti-Spam answer you entered is not correct.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\r\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Phone: ".clean_string($phone)."\r\n";
$email_message .= "Enquiry: ".clean_string($enquiry)."\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
header("Location: $thankyou");
?>
<script>location.replace('<?php echo $thankyou;?>')</script>
<?php
}
die();
?>