Results 1 to 6 of 6

Thread: Forms
      
   

  1. #1
    BIC
    BIC is offline Private First Class
    Join Date
    Oct 2007
    Posts
    7

    Question 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

  2. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

  3. #3
    Sarah's Avatar
    Sarah is offline Colonel
    Join Date
    May 2005
    Location
    Wilmington, Delaware
    Posts
    513

    Default 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
    07031847328 / United Kingdom

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

    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)



  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default 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!


  5. #5
    lemmondr is offline Second Lieutenant
    Join Date
    Sep 2007
    Posts
    104

    Default 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);
    ?>

  6. #6
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default 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!


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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49