Forms

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • BIC
    Private First Class

    • Oct 2007
    • 7

    Forms

    I have created a form per the directions of the tutorials and have entered the following code on the .php page as directed:
    <?PHP
    $mailto = "info@sfevcx.com";
    $email = $HTTP_POST_VARS['email'];
    if ($email == "") {
    $email = $mailto;
    }
    $mailsubj = "Contact BIC";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Values submitted from web site form :\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS))
    {
    if ($key!="submit")
    {
    $mailbody .= "$key : $val\n";
    }
    }
    mail($mailto, $mailsubj, $mailbody, $mailhead);
    ?>

    The form is still not functional and I am receiveing the error message:

    Parse error: syntax error, unexpected '<' in /home/qwxqsmue/public_html/action.php on line 40

    Please help! What am I doing wrong.

    Suzanne
  • Watdaflip
    Major General

    • Sep 2005
    • 2116

    #2
    Re: Forms

    You are probably missing a ?> at the end of the php script you inserted onto you page,

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

    Comment

    • Sarah
      Colonel

      • May 2005
      • 513

      #3
      Re: Forms

      You have inserted your code twice, once between the head tags (which will not work) and then between the body tags. The second one is incomplete:

      $email = $HTTP_POST_VARS[email];
      $mailto = "info@biccorp.com";
      $mailsubj = "Contact Form Submission";
      $mailhead = "From: $email\n";
      reset ($HTTP_POST_VARS);
      $mailbody = "Values submitted from website form;\n";
      while (list ($key, $val) = each ($HTTP_POST_VARS))
      {

      You need to recreate the page from scratch, this time insert the full script between the body tags and it will work!

      Sarah

      VodaHost

      Your Website People!
      1-302-283-3777 North America / International
      02036089024 / United Kingdom
      291916438 / Australia

      ------------------------

      Top 3 Best Sellers

      Web Hosting - Unlimited disk space & bandwidth.

      Reseller Hosting - Start your own web hosting business.

      Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)


      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Forms

        Unless Sarah can see something that i cant, the script is correct. Only explanation, as Watdaflip said, you have forgotten (in the page, here it is correct) the closing tag

        <?PHP
        $mailto = "info@sfevcx.com";
        $email = $HTTP_POST_VARS['email'];
        if ($email == "") {
        $email = $mailto;
        }
        $mailsubj = "Contact BIC";
        $mailhead = "From: $email\n";
        reset ($HTTP_POST_VARS);
        $mailbody = "Values submitted from web site form :\n";
        while (list ($key, $val) = each ($HTTP_POST_VARS))
        {
        if ($key!="submit")
        {
        $mailbody .= "$key : $val\n";
        }
        }
        mail($mailto, $mailsubj, $mailbody, $mailhead);
        ?>

        This last part in red is the one that you must have forgoten.

        And, to my knowledge, the code will work in whichever tag of the page html : Start of page (which i prefer), Between head, inside body, end of page.

        The php code is not like the html code, it is executed anywhere in the page code.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        • lemmondr
          Second Lieutenant

          • Sep 2007
          • 104

          #5
          Re: Forms

          Naval, Sarah, which is the correct code???? both PHP codes you have listed are different.

          Daniel


          Sarah's Code:

          $email = $HTTP_POST_VARS[email];
          $mailto = "info@biccorp.com";
          $mailsubj = "Contact Form Submission";
          $mailhead = "From: $email\n";
          reset ($HTTP_POST_VARS);
          $mailbody = "Values submitted from website form;\n";
          while (list ($key, $val) = each ($HTTP_POST_VARS))
          {

          Naval's Code:

          <?PHP
          $mailto = "info@sfevcx.com";
          $email = $HTTP_POST_VARS['email'];
          if ($email == "") {
          $email = $mailto;
          }
          $mailsubj = "Contact BIC";
          $mailhead = "From: $email\n";
          reset ($HTTP_POST_VARS);
          $mailbody = "Values submitted from web site form :\n";
          while (list ($key, $val) = each ($HTTP_POST_VARS))
          {
          if ($key!="submit")
          {
          $mailbody .= "$key : $val\n";
          }
          }
          mail($mailto, $mailsubj, $mailbody, $mailhead);
          ?>

          Comment

          • navaldesign
            General & Forum Moderator

            • Oct 2005
            • 12080

            #6
            Re: Forms

            Sarah DID NOT post any code, she was merely stating that the code that BIC had used was incomplete.
            You can use the one i posted.

            This is the same one that is included in the Forms Tutorial Part 1.
            Navaldesign
            Logger Lite: Low Cost, Customizable, multifeatured Login script
            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

            Comment

            Working...
            X