unexpected $end of file

I have been trying the “Trivia Game”(Chapter44) shown in the “PHP6 and mySQL Bible” and have had the following problems.
When parsing the code I get the following error on three of the php files.

Parse error: syntax error, unexpected $end in C:\PHP\Trivia Game\entry_form.php on line 93

These files use the heradoc notation <<<EOT … EOT;
When I use this the remaining code appears only as text in either notepad++ or Nusphere software which means when I get to the end of the file the ?> is not the right color (meaning the same at the top) Are these issues related or is there another problem. See

<?php include_once("certainty_utils.php"); include_once("game_parameters_class.php"); $params = new GameParameters(); $connection = $params->getConnection(); if(get_post_value('POSTCHECK')) { handleEntryForm(); } displayEntryForm(); function handleEntryForm () { $question = mysql_real_escape_string(get_post_value('QUESTION')); $answer = mysql_real_escape_string(get_post_value('ANSWER')); $lower_limit = mysql_real_escape_string(get_post_value('LOWER_LIMIT')); $upper_limit = mysql_real_escape_string(get_post_value('UPPER_LIMIT')); $level = mysql_real_escape_string(get_post_value('LEVEL')); $subject = mysql_real_escape_string(get_post_value('SUBJECT')); $scaling_type = mysql_real_escape_string(get_post_value('SCALING_TYPE')); $attribution = mysql_real_escape_string(get_post_value('ATTRIBUTION')); if ($upper_limit > $lower_limit) { $query = "INSERT INTO question (question, answer, lower_limit, upper_limit, level, subjectID, scaling_type, attribution) VALUES ('$question', $answer, $lower_limit, $upper_limit, $level, $subject, $scaling_type, '$attribution')"; $result = mysql_query($query); if ($result) { print("Entry was successful
"); } else { print("Entry was not successful
"); } } else { print("Upper limit must be greater than lower
"); } } function displayEntryForm () { global $PHP_SELF; $linear = CERTAINTY_LINEAR; $geometric = CERTAINTY_GEOMETRIC; $subject_string = make_subject_string(); $form_string = <<<EOT Question:
Answer: <INPUT TYPE=TEXT NAME=ANSWER
Lower: <INPUT TYPE=TEXT NAME=LOWER_LIMIT
Upper: <INPUT TYPE=TEXT NAME=UPPER_LIMIT
Level: <INPUT TYPE=TEXT NAME=LEVEL
Subject: $subject_string
Scaling type: Linear Geometric
Attribution: <INPUT TYPE=TEXT NAME=ATTRIBUTION
EOT; echo $form_string } function make_subject_string () { $result_string = ""; $query = "SELECT id, subject FROM subject ORDER BY id"; $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { $id = $row[0]; $display = $row[1]; $result_string .= "$display"; } $result_string .= ""; return($result_string); } ?>

The EOT; can’t be indented in your PHP file at all. Make sure it is the first thing on it’s line.

Thank you Smokey
Problem Resolved- is there a place where I close this issue?

Sponsor our Newsletter | Privacy Policy | Terms of Service