Parse error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • rypurvis
    Corporal

    • Nov 2006
    • 19

    Parse error

    Can anyone help me with this code?
    Error message I receive is
    "Parse error: syntax error, unexpected '{' in /home2/zomjwzgn/public_html/process123.php on line 328"

    Here is my script:

    <?php
    $advertisement = $HTTP_POST_VARS['advertisement'];
    $name = $HTTP_POST_VARS['name'];
    $phone = $HTTP_POST_VARS['phone'];
    $city = $HTTP_POST_VARS['city'];
    $email = $HTTP_POST_VARS['email'];
    $event = $HTTP_POST_VARS['event'];
    $date = $HTTP_POST_VARS['date'];
    $guests = $HTTP_POST_VARS['guests'];
    $start = $HTTP_POST_VARS['start'];
    $end = $HTTP_POST_VARS['end'];
    $details = $HTTP_POST_VARS['details'];
    if (strlen($advertisement) == 0)
    {
    echo "It appears that you have forgot to fill in the How did you hear about us? field. Please use the Back Button to return to the form and fill in How you
    heard about us. Thank you!";
    exit;
    }
    if (strlen($advertisement) >=30)
    {
    echo "The length limit for the How did you hear about us? field cannot exceed 30 characters / spaces. Please use the Back Button to return to the form and
    shorten this entry. Thank you!";
    exit;
    }
    if (strlen($name) == 0)
    {
    echo "It appears that you have forgot to fill in your name in the Name field. Please use the Back Button to return to the form and enter your name. Thank
    you!";
    exit;
    }
    if (strlen($name) >=30)
    {
    echo "The length limit for the Name field cannot exceed 30 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($phone) == 0)
    {
    echo "It appears that you have forgot to fill in your phone number. Please use the Back Button to return to the form and enter your number. Thank you!";
    exit;
    }
    if (strlen($phone) >=14)
    {
    echo "Your phone number cannot exceed 14 characters / spaces. Please use the Back Button to return to the form and shorten this entry. Thank you!";
    exit;
    }
    if (strlen($city) == 0)
    {
    echo "It appears that you have forgot to fill in your City, STate, and Zip. Please use the Back Button to return to the form and enter that information.
    Thank you!";
    exit;
    }
    if (strlen($city) >=30)
    {
    echo "The length limit for the City, St Zip field cannot exceed 30 characters / spaces. Please use the Back Button to return to the form and shorten this
    entry. Thank you!";
    exit;
    }
    if (strlen($email) == 0)
    {
    echo "The E-mail field is a required entry. Please use the Back Button to return to the form and enter a contact E-mail address. Thank you!";
    exit;
    }
    if (strlen($email) >= 45)
    {
    echo "The length limit for the E-Mail field cannot exceed 45 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
    {
    echo "I believe that there is an error in the way you entered your E-mail address. Please check your entry and re-submit. Thank you!";
    exit;
    }
    if (strlen($event) == 0)
    {
    echo "It appears that you have forgot to fill in your type of event. Please use the Back Button to return to the form and enter your event type. Thank
    you!";
    exit;
    }
    if (strlen($event) >=30)
    {
    echo "The length limit for the Name field cannot exceed 30 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($date) == 0)
    {
    echo "It appears that you have forgot to fill in your the date of your event. Please use the Back Button to return to the form and enter the event date.
    Thank you!";
    exit;
    }
    if (strlen($date) >=1
    {
    echo "The length limit for the Name field cannot exceed 18 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($guests) == 0)
    {
    echo "It appears that you have forgot to fill in the number of guests you expect to attend. Please use the Back Button to return to the form and enter the
    estimated number of guest that you expect to attend. Thank you!";
    exit;
    }
    if (strlen($guests) >=6)
    {
    echo "The length limit for the Name field cannot exceed 6 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($start) == 0)
    {
    echo "It appears that you have forgot to fill in your start time. Please use the Back Button to return to the form and enter what time your event starts.
    Thank you!";
    exit;
    }
    if (strlen($start) >=
    {
    echo "The length limit for the Name field cannot exceed 8 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($end) == 0)
    {
    echo "It appears that you have forgot to fill in your end time. Please use the Back Button to return to the form and enter what time your event ends. Thank
    you!";
    exit;
    }
    if (strlen($end) >=
    {
    echo "The length limit for the Name field cannot exceed 8 characters / spaces. Please use the Back Button to return to the form and shorten this entry.
    Thank you!";
    exit;
    }
    if (strlen($details) >= 300)
    {
    echo "The details of your setup and meal area is limited to 300 characters / spaces. It appears that you have exceeded that limit. Please use the back
    button to return to the form and shorten this entry.Thank you!";
    exit;
    }
    if (substr_count($comments , '@') > "2")
    {
    echo "For security reasons this text (comments) area limits the number of @ symbols that can appear within it. It would appear that you have exceeded that
    number. Please use the Back Button to return to the form and correct this. Thank you for your patience!";
    exit;
    }
    //SEND MAIL
    $mailto = "bob@cateredvibes.com";
    $mailsubj = "Catering Inquiry Form";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Website Submission form:\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS))
    {
    $mailbody .= "$key : $val\n";
    }
    mail($mailto,$mailsubj,$mailbody,$mailhead);
    echo "Thank you for visiting our site and filling out our form. We will get back to you within 48 hours!";
    ?>


    Thanks,
    Bob
  • Andy128
    Major General

    • Dec 2005
    • 2317

    #2
    Re: Parse error

    There are a couple errors:

    **Will have to repost as it is giving me errors trying to post answer

    Andy
    PHP- is a blast!

    Comment

    • Andy128
      Major General

      • Dec 2005
      • 2317

      #3
      Re: Parse error

      Ok- lets try again. There are a couple errors. They are;

      First;
      if(strlen($date) >= 1 Should read if(strlen($date) >= 1

      Second;
      if(strlen($start) >= Should read if(strlen($start) >=

      Third;
      if(strlen($end) >= Should read if(strlen($end) >=

      ****For what ever reason it is treating my # eight and the right bracket as a picture. So- just make
      sure to add the number and bracket where missing in the above lines. Perhaps this is an issue only
      with my computer- I will be testing it. NO IT IS NOT WITH MY COMPUTER BUT WITH THE
      FORUM ITSELF.

      I have often done this while copy/pasting code. It is difficult to
      find sometimes in a long script. At that point I simply walk away for a
      while and then re-visit it.

      That should work. I'll be around most of the day so post back if any more
      problems.

      Cheers-

      Andy
      PHP- is a blast!

      Comment

      • rypurvis
        Corporal

        • Nov 2006
        • 19

        #4
        Re: Parse error

        Andy,
        That worked. I've been working at this for about two hours. You come along and it took two minutes. It's people like you that makes all this worth while.Thanks again.

        Bob

        Comment

        • rypurvis
          Corporal

          • Nov 2006
          • 19

          #5
          Re: Parse error

          Andy,
          One more problem.
          When someone finishes the form, the return page has the "ERROR PAGE" still at the top. How do I change this?

          Bob

          Comment

          • Andy128
            Major General

            • Dec 2005
            • 2317

            #6
            Re: Parse error

            Bob-

            I would simply remove the ERROR PAGE text. It really isn't needed. The echo statement tells them that there is an error and instructs them how to fix it.

            If you still really want the ERROR PAGE text to be present- then you would need to make another page with out the ERROR PAGE text, and at the very end of the script - re-direct them to that page which will contain the "Thanks for visiting our site an...............".

            Let me know what you decide.

            And by the way- your welcome and any time.

            Andy
            PHP- is a blast!

            Comment

            Working...
            X