我在php编程方面相当不错,我知道这种错误意味着我错过了什么,但我似乎无法弄清楚我错过了什么。我有所有的括号和分号。我不知道为什么会出现这个错误。以下是代码:
解析错误:语法错误,第44行的C:\ Program Files(x86)\ EasyPHP-5.3.9 \ www \ Website Stuff \ Form.php中的意外T_VARIABLE
<?php
error_reporting (E_ALL ^ E_NOTICE);
$to = "gene.howell9@gmail.com";
$subject = "Submitions from College/University Admission Services Form";
$Sname = $_POST["Sname"];
$Fname = $_POST["Fname"];
$Mname = $_POST["Mname"];
$Lname = $_POST["Lname"];
$email = $_POST["email"];
$history = $_POST["history"];
$age = $_POST["age"];
$sex = $_POST["sex"];
$country = $_POST["country"];
$SchoolsAttended = $_POST["SchoolsAttended"];
$CriminalRecord = $_POST["CriminalRecord"];
$record = $_POST["record"];
$status = $_POST["status"];
$body = <<<EMAIL
Form submitted from $Fname $Lname.
Surname field: $Sname
First name field: $Fname
Middle name field: $Mname
Last name field: $Lname
History field: $history
Age: $age
Sex: $sex
Country: $country
Schools Attended: $SchoolsAttended
Criminal Record: $CriminalRecord
If yes was selected, list of details: $record
Marital Status: $status
From, $Fname
EMAIL;
$header = "From: $email";
if($_POST){
if($Sname == '' || $Fname == '' $Mname == '' || $Lname == '' $email == '' || $history == '' $age == '' || $sex == '' $country == '' || $SchoolsAttended == '' $CriminalRecord == '' || $status == ''){
$feedback = "Fill out all the fields please before submitting";
}else{
mail($to, $subject, $body, $header);
$feedback ="Thanks for your submition! Your form has been sent!";
}
}
?>
<p id="feedback"><?php echo $feedback; ?></p>
<form style="padding: 10px;" method="post" action="?">
Surname: <input type="text" maxlength="12" name="Sname"><br /><br />
First Name: <input type="text" maxlength="12" name="Fname"><br /><br />
Middle Name: <input type="text" maxlength="12" name="Mname"><br /><br />
Last Name: <input type="text" maxlength="36" name="Lname"><br /><br />
Email: <input type="text" maxlength="36" name="email"><br /><br />
History: <input type="text" maxlength="50" name="history"><br /><br />
Age: <input type="text" size="1" maxlength="2" name="age"><br /><br />
Sex: <input type="radio" value="Male" name="sex">Male<input type="radio" value="Female" name="sex">Female<br /><br />
Country of Origin: <select name="country">
<option value="Select">-Select a Country-</option>
<option value="United States">United States</option>
<option value="Africa">Africa</option>
<option value="Canada">Canada</option>
</select><br /><br />
Schools Attended: <input type="text" name="SchoolsAttended"><br /><br />
Do you have a criminal record? <input type="radio" value="yes" name="CriminalRecord">Yes <input type="radio" value="no" name="CriminalRecord">No<br /><br />
If yes was selected, please list them in the field provided: <input type="text" name="record"><br /><br />
Marital Status: <select name="status">
<option value="select">-Select your status-</option>
<option value="single">Single</option>
<option value="married">Married</option>
<option value="divorced">Divorced</option>
<option value="widowed">Widowed</option>
</select><br /><br />
<input class="button" type="submit" value="submit" name="submit"> <input class="button" type="reset" value="Reset" name="reset" />
</form>
感谢您的帮助!这可能是一个小问题! -TechGuy24
答案 0 :(得分:8)
你错过了一堆||
。
例如:
$history == '' $age == ''
应该是:
$history == '' || $age == ''