Parse error: syntax error, unexpected $end in
I keep getting that, I have no clue where to fix it. Any help would be VERY APPRECIATED!
I keep getting that, I have no clue where to fix it. Any help would be VERY APPRECIATED!
Code:
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "tony@example.com";
$email_subject = "New Email from CASE EVALUATION form in email";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form your submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['full_name']) ||
!isset($_POST['address']) ||
!isset($_POST['phone']) ||
!isset($_POST['email']) ||
!isset($_POST['best']) ||
!isset($_POST['role_in_matter']) ||
!isset($_POST['where']) ||
!isset($_POST['when']) ||
!isset($_POST['what']) ||
!isset($_POST['what_two']) ||
!isset($_POST['what_three']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form your submitted.');
}
$full_name = $_POST['full_name']; // required
$address = $_POST['address']; // required
$phone = $_POST['phone']; // required
$email = $_POST['email']; // required
$best = $_POST['best']; // required
$role_in_matter = $_POST['role_in_matter']; // required
$where = $_POST['where']; // required
$when = $_POST['when']; // required
$what = $_POST['what']; // required
$what_two = $_POST['what_two']; // not required
$what_three = $_POST['what_three']; // not required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$full_name)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$address)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$phone)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($string_exp,$email)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$best)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9]+$";
if(!eregi($string_exp,$role_in_matter)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$where)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$when)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
if(!eregi($string_exp,$what)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$what_two)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
$string_exp = "^[a-z0-9 .'-]+$";
if(!eregi($string_exp,$what_three)) {
$error_message .= 'The text you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The pertinent information you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Legal Name: ".clean_string($full_name)."\n";
$email_message .= "Your address: ".clean_string($address)."\n";
$email_message .= "Your phone number: ".clean_string($phone)."\n";
$email_message .= "Your email address: ".clean_string($email)."\n";
$email_message .= "Best time and way to contact you: ".clean_string($best)."\n";
$email_message .= "Your role in this matter: ".clean_string($role_in_matter)."\n";
$email_message .= "Where was the ticket received?: ".clean_string($where)."\n";
$email_message .= "When did you receive it? There are strict deadlines, so this is very important.: ".clean_string($when)."\n";
$email_message .= "What type of law enforcement officer stopped you?: ".clean_string($what)."\n";
$email_message .= "What is the allegation? : ".clean_string($what_two)."\n";
$email_message .= "What court your case is in: ".clean_string($what_three)."\n";
$email_message .= "Other Pertinent Information: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$full_name."\r\n".
'Reply-To: '.$full_name."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Comment