Hi guys, I just started using php and have run into a problem which I just can't seem to figure out. I keep getting this $end error on line 80, but I just don't get it. I have read this over and over and I've closed all tags, even tried adding an extra '}'
The latter does remove the syntax error, but gives me a blank page instead of the thank you message it should. Can anyone please help me, I've added the script below:
<?php
if(isset($_POST['Email_Address'])) {
include 'settings.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 go <a href='javascript:history.go(-1)'>back</a> and fix these errors.<br /><br />";
die();
}
if(!isset($_POST['Full_Name']) ||
!isset($_POST['Email_Address']) ||
!isset($_POST['Telephone_Number']) ||
!isset($_POST['Your_Message']) ||
!isset($_POST['Ammount_People']) ||
!isset($_POST['Date_Listed']) ||
!isset($_POST['Time_Request'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$full_name = $_POST['Full_Name']; // required
$email_from = $_POST['Email_Address']; // required
$telephone = $_POST['Telephone_Number']; // required
$comments = $_POST['Your_Message']; // not required
$people = $_POST['Ammount_People']; // required
$mdate = $_POST['Date_Listed']; // required
$time = $_POST['Time_Requested']; // 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($full_name) < 2) {
$error_message .= 'Your Name does not appear to be valid.<br />';
}
if(strlen($telephone) > 15) {
$error_message .= 'The Telephone Number you entered does not appear to be valid.<br />';
}
if(strlen($telephone) < 6) {
$error_message .= 'Please enter a valid phone number.<br />';
}
if(strlen($people)==notEmptry) {
$error_message .= 'Please specify how many people will be joining your party.<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:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Name: ".clean_string($full_name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Telephone: ".clean_string($telephone)."\r\n";
$email_message .= "Message: ".clean_string($comments)."\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();
?>