SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parse error: syntax error in Contact Form

    In the 33 lines of code, apparently line 32 has an issue:

    "Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/public_html/wr/form_handle.php on line 32"

    Any help will be appreciated to resolve the issue. Thanks

    Code:
    <?php
    $mailto     = 'email@email.com';
    $mailsubj   = "Contact Form submission";
    $mailhead   = "From:CForm\n";
    $mailbody   = "--- Contact form results ---\n";
    foreach($_REQUEST as $key => $value)    
    {    
    if($key != 'PHPSESSID')        
    {        
    $mailbody .= $key.": ".$value."\n";        
    }    
    }
    $continue = true;if(isset($_POST['ans']) && $_POST['ans']!='hot')
    
    {  
    
    echo 'Wrong answer!';  $continue = false;
    }
    // if the check box is not checked it will not appear in the $_POST values, it's better to use isset rather than emptyif(isset($_POST['agree']))
    {  
    echo "If you agree with the terms, check the Agree check box";  
    $continue = false;
    }
    if($continue)
    {  
    $mailbody .= date('Y-m-d H:i:s',strtotime("now"));  
    mail($mailto, $mailsubj, $mailbody, $mailhead);  
    echo "<h2>Thanks!</h2>"  
    //print_r($_REQUEST);
    }?>

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Code:
    echo "<h2>Thanks!</h2>"
    That statement needs to be ended with a semicolon.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,061
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    You forgot the ; at the end of echo "<h2>Thanks!</h2>"
    Edit:

    FF beat me to it
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  4. #4
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are missing a semicolon in line 28:

    echo "<h2>Thanks!</h2>";
    Web designer, programmer & webmaster for 7+ years
    Hosting 11 sites in Hospedaje Web México
    CentOS|cPanel|R1Soft|Softaculous|Cloud Hosting|Green Hosting


Bookmarks

Posting Permissions

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