はい私はこれをしていると信じていますが、パースエラー:パースエラー、予期しない$ endをC:\ wamp \ www \ contactform.phpの106行目に表示しています。私が考えることができると思うのは、else、elseif、間違っている場合、私はそれらが別のものになるかどうかを見るためにそれらを切り替えようとしています。しかし、これまでのところ何もありません。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