Jump to content

Search the Community

Showing results for tags 'php parse error confirmation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. 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? <?php if (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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.