I have to find all the syntax errors in this php file, any help is appreciated

<?php
$WaitTime = addslashes($_POST['wait_time']);
$Friendliness = addslashes($_POST['friendliness']); //missing ) and ;
$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) //too many ))
    echo "<p>You must enter a value in each field. Click
     your browser's Back button to return to the form.</p>";   // no hr needed
else {
    $Entry .= $WaitTime . "\n";   //no .
    $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) //missing )
            fclose($SurveyFile);
    }   
        else
            echo "<p>The entry could not be saved!</p>";

}
?>

empty($Noise) //too many ))

Should be

empty($Noise)){ 

Cause it's inside an if statement, i added the curly bracket cause im not sure how it acts without them - i think it only will execute the next single line of code if you don't add a curly bracket

else {
//to
}else{//for the opened curly bracket on the if

$Entry = '';//$Entry is never defined?

flock($SurveyFile, LOCK_UN); //missing ) and missing ;

Heres what i ended up with anyway

<?php
$WaitTime = addslashes($_POST['wait_time']);
$Friendliness = addslashes($_POST['friendliness']); //missing ) and ;
$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)){ //too many ))
        echo "<p>You must enter a value in each field. Click your browser's Back button to return to the form.</p>"; // no hr needed
}else {
    $Entry = '';
    $Entry .= $WaitTime . "\n"; //no .
    $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); //missing )
            fclose($SurveyFile);
        }
    }else{
        echo "<p>The entry could not be saved!</p>";
    }
}
?>

Can't see anything else and all valid code according to zend studio now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.