carpenterw10 Posted April 12, 2012 Share Posted April 12, 2012 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> Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 12, 2012 Share Posted April 12, 2012 $SurveyFile = fopen("survey.txt", "w") missing a ; at the end. Also later you have ?d> where I suspect you want ?> Quote Link to comment Share on other sites More sharing options...
xyph Posted April 12, 2012 Share Posted April 12, 2012 The offending line is $SurveyFile = fopen("survey.txt", "w") For me, it's the most common mistake when I see the unexpected T_IF error. [edit] beat to it [/edit] Quote Link to comment Share on other sites More sharing options...
carpenterw10 Posted April 12, 2012 Author Share Posted April 12, 2012 Thanks for the help I fixed that error. now I am getting a Parse error: syntax error, unexpected T_ELSE in /var/www/html/homework9/RecordSurvey.php on line 39 i think it has to do with my else statements Do I need an else if statement instead of else Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 12, 2012 Share Posted April 12, 2012 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. Quote Link to comment Share on other sites More sharing options...
carpenterw10 Posted April 12, 2012 Author Share Posted April 12, 2012 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. Quote Link to comment Share on other sites More sharing options...
xyph Posted April 12, 2012 Share Posted April 12, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.