douya2006 2013-04-04 15:51
浏览 34
已采纳

在最后一行解析错误[关闭]

i have corrected and cleaned up previous code,, php and html.. i get parsing error at last line.. i dont know whats wrong.. also, site makes me add useless text for post all responses are appreciated. thanx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>

<?php
if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = 'xxx.com, ';
    $email_subject = "xxx Questons";

    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['email']) ||    
       !isset($_POST['comments'])) 
    {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }

    $name = $_POST['name']; // not required


    $email_from = $_POST['email']; // required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";

    if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.

";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "Name: ".clean_string($name)."
";

    $email_message .= "Email: ".clean_string($email_from)."
";

    $email_message .= "Comments: ".clean_string($comments)."
";     

// create email headers
$headers = 'From: '.$email_from."
".
'Reply-To: '.$email_from."
" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

<!--include your own success html here -->
<!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="Refresh" content="10; URL=xxxx"> 
 <title>xxx xxcx xxx</title>
 <meta http-equiv="Content-Language" content="en-us" />
  <meta http-equiv="imagetoolbar" content="no" />

      <meta name="MSSmartTagsPreventParsing" content="true" />

    <meta name="description" content="xxxsxxx xxx. " />

    <meta name="keywords" content="orchids, xxx, Orchid judging, xxx" /><style type="text/css" media="all">@import "css/master.css";</style>
</head>
<body> 
<p><div id="textbox"><br><br>

<center><h1>Thank you for contacting us. <br />
We will be in touch with you very soon.</h1>

<br><br>  

Please wait 10 seconds and you will be transferred to the next page or <a href=http:xxxindex.html><font color="#0000ff">click here</font></a> to go now!</center>

<p><center>Please visit our website <a href="xxx"><i>www.</i></a> to learn more <br />
    about the xxx</center>
<p>&nbsp;</p>
</div>    
</div>
</div> 

</body>
</html>
 </body>
 </html>
  • 写回答

2条回答 默认 最新

  • douyoufan7881 2013-04-04 15:53
    关注

    You're missing a closing } at the end of the PHP code

    The original opening { is coming from this line:

    if(isset($_POST['email'])) {
    

    So, after the mail function, add another }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持