I believe there is a logic error in my PHP code. I used debugging and the error is on line 48 which is th third and last "else" statement else {. The code is fine I just don't understand what is wrong with line 48. Full Code for reference.
<?php
$WaitTime = addslashes($_POST["wait_time"]);
//Mising Closing Parenthesis and semicolon
$Friendliness = addslashes($_POST["friendliness"]);
$Space = addslashes($_POST["space"]);
//Missing "$" in POST method
$Comfort = addslashes($_POST["comfort"]);
$Cleanliness = addslashes($_POST["cleanliness"]);
$Noise = addslashes($_POST["noise"]);
if (empty($WaitTime) ||
empty($Friendliness) ||
empty($Space) ||
empty($Comfort) ||
empty($Cleanliness) ||
//missing "||"
empty($Noise))
echo "<hr /><p>You must enter a value in each field. Click
your browser's Back button to return to the form.</p><hr />";
else {
$Entry = $WaitTime . "\n";
$Entry .= $Friendliness . "\n";
$Entry .= $Space . "\n";
$Entry .= $Comfort . "\n";
$Entry .= $Cleanliness . "\n";
$Entry .= $Noise . "\n";
//Missing closing semicolon
$SurveyFile = fopen("survey.txt", "w");
if (flock($SurveyFile, LOCK_EX)) {
if (fwrite($SurveyFile, $Entry) > 0) {
echo "<p>The entry has been successfully added.</p>";
//missing closing parenthesis
flock($SurveyFile, LOCK_UN);
fclose($SurveyFile);
//Missing bracket
}
else {
echo "<p>The entry could not be saved!</p>";
}
else {
echo "<p>The entry could not be saved!</p>";
}
}
}
?>
Aucun commentaire:
Enregistrer un commentaire