-3

I am trying to make a webpage that will take user input and add it to a .txt file. It is supposed to work like this webpage http://150.216.54.86:808/homework8/AirlineSurvey.html Why am I receiving "Parse error: syntax error, unexpected ';'" on line 27?

<?php
$WaitTime = addslashes($_POST["wait_time"]);
$Friendliness = addslashes($_POST["friendliness"]); //missing );
$Space = addslashes($_POST["space"]);
$Comfort = addslashes($_POST["comfort"]); //missing $
$Cleanliness = addslashes($_POST["cleanliness"]);
$Noise = addslashes($_POST["noise"]);
if (empty($WaitTime) ||
    empty($Friendliness) ||
    empty($Space) ||
    empty($Comfort) ||
    empty($Cleanliness) ||
    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";
        $SurveyFile = fopen("survey.txt", "w"); /missing ;
        if (flock($SurveyFile, LOCK_EX)) {
                if (fwrite($SurveyFile, $Entry) > 0) {
                        echo "<p>The entry has been successfully added.</p>";
                        flock($SurveyFile, LOCK_UN;
                        fclose($SurveyFile);
                else
                        echo "<p>The entry could not be saved!</p>";
            }
        } else
                echo "<p>The entry could not be saved!</p>";
    }
            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";
        $SurveyFile = fopen("survey.txt", "w"); //missing ;
//missing }
        }
        if (flock($SurveyFile, LOCK_EX)) {
                if (fwrite($SurveyFile, $Entry) > 0) {
                        echo "<p>The entry has been successfully added.</p>";
                        flock($SurveyFile, LOCK_UN;
                        fclose($SurveyFile);

                else
                        echo "<p>The entry could not be saved!</p>";
        }
        else {
                echo "<p>The entry could not be saved!</p>";
    }
}

?>

1 Answers1

1

You've missed a close parenthesis ) at your flock($SurveyFile, LOCK_UN;, that's why you are receiving parse error.

It should be like this flock($SurveyFile, LOCK_UN);

Jeruson
  • 125
  • 11