Jump to content

Parse error: syntax error, unexpected T_IF in /var/www/html/homework9/RecordSurv


carpenterw10

Recommended Posts

I just enabled error reporting and I am not that familiar with it.  I know I have an error some where around line 33.  I know I am missing a bracket or a comma or some other syntax error I just cannot find where the error is.  Below is my script.

Thanks for any help.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Airline Survey</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Revised by abc1234"/>
</head>
<body>
<?php
$WaitTime = addslashes($_POST["wait_time"]);
$Friendliness = addslashes($_POST["friendliness"]);
$Space = addslashes($_POST["space"]);
$Comfort = addslashes($_POST["comfort"]);
$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")
	}
        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>";
}
?d>
<p><a href="AirlineSurvey.html">Return to Airline Survey</a></p>
</body>
</html>

Link to comment
Share on other sites

you also are missing a paren on a line.

flock($SurveyFile, LOCK_UN;

 

Go through every line and make sure it matches up. If you pick a color for () and {} and ; in your editor it might help. In the future, look near the lines in the error for stuff like this. These are little things.

Link to comment
Share on other sites

Thanks again,  but I had already fixed that error, re-tested the web page and it gave me the error Parse error: syntax error, unexpected T_ELSE in /var/www/html/homework9/RecordSurvey.php on line 39

 

I can not figure out if I am missing a bracket or if the error has to do with the else statements.

 

 

Link to comment
Share on other sites

WE ARE NOT YOUR PERSONAL DEBUGGING SERVICE

 

Use curly braces on all conditionals and loops until you can debug well on your own. That alone will solve your parse error.

 

The issue here is curly brace placement. Good luck.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.