Parse error:
Results 1 to 2 of 2

Thread: Parse error:

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    1

    Parse error:

    Thanks for any help. I am new to this and I truly appreciate your knowledge.
    I am trying to make a simple form functional on my site, when I try to submit the form, I get this error:
    Parse error: syntax error, unexpected T_STRING in /home/rkstith/public_html/send_form_email.php on line 4

    Here is my php code:

    PHP Code:
    <?php
    if(isset($_POST['email'])) {
    &
    #65533;����
    &#65533;���// EDIT THE 2 LINES BELOW AS REQUIRED
    &#65533;���$email_to = "customerservice@stithaquatics.com";
    &#65533;���$email_subject = "Web Submission";
    &#65533;����
    &#65533;����
    &#65533;���function died($error) {
    &#65533;�������// your error code can go here
    &#65533;�������echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    &#65533;�������echo "These errors appear below.<br /><br />";
    &#65533;�������echo $error."<br /><br />";
    &#65533;�������echo "Please go back and fix these errors.<br /><br />";
    &#65533;�������die();
    &#65533;���}
    &#65533;����
    &#65533;���// validation expected data exists
    &#65533;���if(!isset($_POST['first_name']) ||
    &#65533;�������!isset($_POST['last_name']) ||
    &#65533;�������!isset($_POST['email']) ||
    &#65533;�������!isset($_POST['telephone']) ||
    &#65533;�������!isset($_POST['comments'])) {
    &#65533;�������died('We are sorry, but there appears to be a problem with the form you submitted.');������ 
    &#65533;���}
    &#65533;����
    &#65533;���$first_name = $_POST['first_name']; // required
    &#65533;���$last_name = $_POST['last_name']; // required
    &#65533;���$email_from = $_POST['email']; // required
    &#65533;���$telephone = $_POST['telephone']; // not required
    &#65533;���$comments = $_POST['comments']; // required
    &#65533;����
    &#65533;���$error_message = "";
    &#65533;���$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    &#65533;�if(!preg_match($email_exp,$email_from)) {
    &#65533;���$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
    &#65533;�}
    &#65533;���$string_exp = "/^[A-Za-z .'-]+$/";
    &#65533;�if(!preg_match($string_exp,$first_name)) {
    &#65533;���$error_message .= 'The First Name you entered does not appear to be valid.<br />';
    &#65533;�}
    &#65533;�if(!preg_match($string_exp,$last_name)) {
    &#65533;���$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
    &#65533;�}
    &#65533;�if(strlen($comments) < 2) {
    &#65533;���$error_message .= 'The Comments you entered do not appear to be valid.<br />';
    &#65533;�}
    &#65533;�if(strlen($error_message) > 0) {
    &#65533;���died($error_message);
    &#65533;�}
    &#65533;���$email_message = "Form details below.\n\n";
    &#65533;����
    &#65533;���function clean_string($string) {
    &#65533;�����$bad = array("content-type","bcc:","to:","cc:","href");
    &#65533;�����return str_replace($bad,"",$string);
    &#65533;���}
    &#65533;����
    &#65533;���$email_message .= "First Name: ".clean_string($first_name)."\n";
    &#65533;���$email_message .= "Last Name: ".clean_string($last_name)."\n";
    &#65533;���$email_message .= "Email: ".clean_string($email_from)."\n";
    &#65533;���$email_message .= "Telephone: ".clean_string($telephone)."\n";
    &#65533;���$email_message .= "Comments: ".clean_string($comments)."\n";
    &#65533;����
    &#65533;����
    // 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);&#65533; 
    ?>

    <!-- include your own success html here -->

    Thank you for contacting us. We will be in touch with you very soon.

    <?php
    }
    ?>
    Last edited by bradgrafelman; 04-18-2012 at 01:42 PM. Reason: PHP bbcode tags added

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,353
    Welcome to PHPBuilder! When posting PHP code, please use the board's [php]..[/php] bbcode tags as they make your code much easier to read and analyze.

    As for your issue... notice all of the '�' symbols in your code snippet above? (Pretend the instances of '&#65533;' are that same '�' symbol - vBulletin gets a little wonky sometimes with certain characters.) Those most certainly shouldn't be there.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •