<html>
<head>
<meta http-equiv="Content-Type" content="text/html";charset="charset"/>
<title>handle_posting</title>
<head>
<body>
<?php
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email_address=$_POST['email_address'];
$sex=$_POST['sex'];
$posting=nl2br($_POST['posting']);
$name=$first_name.' '.$last_name;
print"<div>Thank you,$name for your posting:
<p>$posting</p>
<p>our team will send the lastest meassage to $email_address.</p>
</div>"
$name=urlencode($name);//使用urlencode进行链接
$email_address=urlencode($_POST['email_address']);
echo "<p>Click<a href=\hand_posting.php?name="$name"&email_address=$email_address\">here</a>to continue.</p>";
?>
</body>
<html>
出现Parse error: syntax error, unexpected '$name' (T_VARIABLE) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\handle_posting.php on line 18错误

解决方案 »

  1.   

    1.输出html的时候尽量使用界定符
    2.另外还有引号使用错误的问题.<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html"
        ;charset="charset"/>
        <title>handle_posting</title>
    <head>
    <body>
    <?php
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $email_address = $_POST['email_address'];
    $sex = $_POST['sex'];
    $posting = nl2br($_POST['posting']);
    $name = $first_name . ' ' . $last_name;
    echo <<<html
        "<div>Thank you,$name for your posting:
    <p>$posting</p>
    <p>our team will send the lastest meassage to $email_address.</p>
    </div>
    html;
    $name = urlencode($name);//使用urlencode进行链接
    $email_address = urlencode($_POST['email_address']);
        echo "<p>Click<a href='hand_posting.php?name=$name&email_address=$email_address'>here</a>to continue.</p>";
    ?>
    </body>
    </html>
      

  2.   

    </p>
    </div>" 加个分号 笨蛋!</p>
    </div>";另外请用echo 输出
      

  3.   


    出现Parse error: syntax error, unexpected '$name' (T_VARIABLE) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\handle_posting.php on line 18错误这种错误几乎是:不是哪里少了个分号,就是哪里少了个引号。