Advanced Search

Results 1 to 4 of 4

Thread: Parse Error I can't even find!

  1. #1
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Parse Error I can't even find!

    I have the following code;

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Rune Voyage</title>
    <link rel="stylesheet" type="text/css" href="styles/main.css">
    </head>
    <body>
    
    <?php
    
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
    
    
    
    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "<span class="style3">Unfortunately, the email address you entered does not seem to be valid.</span>\n";
    $badinput = "<span class="style3">Please go back and try again.</span>\n";
    echo $badinput;
    die ("");
    }
    
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<span class="style3">Sorry, but we were unable to process the form.  Please go back and ensure all fields are completed.</span>\n";
    die ("");
    }
    
    
    $attn = $attn ;
    $subject = $attn;
    
    $notes = stripcslashes($notes);
    
    $message = " \n
    Subject: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    
    mail("runevoyage@googlemail.com", $subject, $message, $from);
    
    ?>
    
    <p align="left" class="style3">
    Thank you <?php echo $visitor ?> for contacting us.</p>
    <p align="left" class="style3">
    Withing the next few minutes you should receive an email from us confirming your contact.<br>
    If you chose to be contacted by us, you will receive your reply to the email address you gave you us- <?php echo $visitormail ?>.</p>
    
    <p align="left" class="style3">
    <a href="index.htm">Continue to Rune Voyage home page.</a></p>
    
    </body>
    </html>
    However, when it runs, I get;

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mrrsman/public_html/sendeail.php on line 28
    (Sendeail.php is the name of the page).

    I can't find an error...let along know how to fix it!

    Please help!

    MrRSMan.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The error comes from not escaping quotes on the following lines:

    Code:
    echo "<span class="style3">Unfortunately, the email address you entered does not seem to be valid.</span>\n";
    $badinput = "<span class="style3">Please go back and try again.</span>\n";
    You should either use single quotes, escape them with a slash ( \" ), or break out of php before sending HTML to the browser.

    Code:
    echo '<span class="style3">Unfortunately, the email address you entered does not seem to be valid.</span>';
    echo "\n";
    
    $badinput = "<span class=\"style3\">Please go back and try again.</span>\n";
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much!

    I'm fairly new to PHP you see...

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Don't output HTML from PHP: it's inefficient and gets ugly fast. Break out of PHP parsing mode, or use a template engine like Smarty.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •