是的我相信我已經完成了,但我收到一條消息,說106線上的C:\ wamp \ www \ contactform.php中的解析錯誤:解析錯誤,意外$結束。在那條線上。唯一想到的是我能想到的是,else,如果是錯誤的,我一直在試圖切換它們,看看是否會有所不同。但到目前爲止還沒有。在PHP中讀取錯誤
</style>
</head>
<body>
<div id="container">
<?php
if (isset($_POST['submit'])){
if (trim($_POST['name'])==""){
$strMessage="Please enter your name!";
showForm($strMessage);
} elseif (isset($_POST['submit'])){
if (trim($_POST['email'])==""){
$strMessage="Please enter your email!";
showForm($strMessage);
}
if(isset($_POST['submit'])){
if (trim($_POST['username'])==""){
$strMessage="Please enter your username!";
showForm($strMessage);
} elseif ($_POST['pword1'] != $_POST['pword2']) {
$_POST['pword1'] = NULL; // Reset the values of pword1 so it is not in the form
$_POST['pword2'] = NULL; // Reset the values of pword2 so it is not in the form
$strMessage="Passwords do not match!";
showForm($strMessage);
} elseif (strlen(trim($_POST['pword1']))<=3){
$strMessage="Your password must be at least 4 characters long!";
showForm($strMessage);
} else {
$strMessage="Thank you, your information has been submitted. Below is the information you sent:";
$strMessageBody.="Name: ".trim(stripslashes($_POST['name']))."<br />";
$strMessageBody.="E-mail: ".trim(stripslashes($_POST['Email']))."<br />";
$strMessageBody.="UserName: ".trim(stripslashes($_POST['username']))."<br />";
$strMessageBody.="Password: ".trim(stripslashes($_POST['pword1']))."<br />";
$strMessageBody.="Re-enter Password: ".trim(stripslashes($_POST['pword2']))."<br />";
echo "<h1>".$strMessage."</h1>";
echo $strMessageBody;
}
} else {
$strMessage= "Please fill out the form below to send your information:";
showForm($strMessage);
}
}
?>
</div>
</body>
</html>
你應該學會更好的縮進。 (使用軟標籤進行縮進)很難讀取您的代碼。你可能在某處有一個缺失的大括號。正確縮進你的代碼;它可以幫助團隊環境中的其他開發人員,即使你是獨自一人,它仍然會幫助你。 – FinalForm
您錯過了一個右大括號。編程不是隨機切換的。 – Jon
第87行的'else'前的'.'是什麼? – rid