Oscar11 Posted December 31, 2013 Share Posted December 31, 2013 Please advise me where the error is please? , An parse error has come back as unexpected $ on line 115. I also need help with another two areas - I have two enquiry forms [one for the student and one for the client]. The student form has, at present, a radio box which the student clicks on if they are under 19 and this would take them to the client page. Once I have submitted the form I want a confirmation page to appear. How do I do this please? Should the coding be in the script or the htmll form? <?phpif (isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "ftnby@yahoo.com" ; $email_subject = "My enquiry to you"; function died($error) { // your error code can go here echo "We are very 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 back and fix these errors.<br /><br />"; die(); // validation expected data exists if(!isset($_POST['your_first_name']) || !isset($_POST['your_surname']) || !isset($_POST['your_home_address']) || !isset($_POST['post_code']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } if (empty($_POST["your_first_name"])) {$nameErr = "Name is required";} else {$name = test_input($_POST["name"]);} if (empty($_POST["your_surname"])) {$nameErr = "Name is required";} else {$name = test_input($_POST["name"]);} if (empty($_POST["email"])) {$emailErr = "Email is required";} else {$email = test_input($_POST["email"]);} if (empty($_POST["home_address"])) {$nameErr = "Address is required";} else {$name = test_input($_POST["address"]);} if (empty($_POST["post_code"])) {$nameErr = "Post code is required";} else {$name = test_input($_POST["post_code"]);} if (empty($_POST["landline_number"])) {$numberErr = "Please provide a Landline or Mobile number";} else {$number = test_input($_POST["comment"]);} if (empty($_POST["students_first_name"])) {$nameErr = "Name is required";} else {$name = test_input($_POST["name"]);} if (empty($_POST["students_surname"])) {$nameErr = "Name is required";} else {$name = test_input($_POST["name"]);} if (empty($_POST["subject_required"])) {$nameErr = "Subject is required";} else {$name = test_input($_POST["name"]);} if (empty($_POST["level_of_study"])) {$nameErr = "Level_of_Study is required";} else {$name = test_input($_POST["name"]);} if(!count($errors) && mail($to, $subject, $body, $headers)){ $error_message = ""; $email_exp = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[a-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments 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); }// create email headers$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.html.php?op=Thank You');}?> Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/285014-error-code-parse-error-unexpected-in-tier-11/ Share on other sites More sharing options...
Ch0cu3r Posted December 31, 2013 Share Posted December 31, 2013 You do not have matching curly braces somewhere. You need to go through your code and make sure every { (opening brace) has a matching } (closing brace) Quote Link to comment https://forums.phpfreaks.com/topic/285014-error-code-parse-error-unexpected-in-tier-11/#findComment-1463478 Share on other sites More sharing options...
requinix Posted December 31, 2013 Share Posted December 31, 2013 Indent your code properly and start using an IDE and you'll see that you're missing not one but two }s. Quote Link to comment https://forums.phpfreaks.com/topic/285014-error-code-parse-error-unexpected-in-tier-11/#findComment-1463479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.