Please help on the below php code i get error on line 35?

  • Thread starter Thread starter Bayoush
  • Start date Start date
B

Bayoush

Guest
<HTML>
<HEAD>
<TITLE>Story Array Game</TITLE>
</HEAD>
<BODY>
<font SIZE=4 COLOR="Red"> Story Array Game</font>
<BR />
<FONT SIZE=4 COLOR="Red">Please fill in the appropriate fields below: </FONT>



<?php

require('story_arrays.php'); // grabs the corresponding case from the story_arrays file

$storyid = rand(1,3); // randomly generates a story in the $storyid array

$storystructure = getStoryArray($storyid); // establishes which $storystructure array case to use

?>

<FORM ACTION= "part3_story.php" METHOD=post> <!-- creates the form in order for the whole process to execute -->



<table border="1" bgcolor="orange">

<?php

/* This script retrieves the corresponding story array.
The conditional then prints the value. */

foreach ($storystructure as $label) {
echo "<tr><td>".$label."</td>";
echo "<td><input type=text name=$label; ></td></tr>";
}

?>
</table>
<input type=hidden name=storyid value="<?php echo $storyid; ?>" />
<input type=submit name=submit value=submit />

</FORM>
<BR>

</BODY>
</HTML>
 
It would be helpful to identify which line is causing problems.

echo "<tr><td>".$label."</td>"; --> echo "<tr><td>" . $label . "</td>";

try that for starters, i think that might be around 35.
 
This line:
echo "<td><input type=text name=$label; ></td></tr>";

is your problem. Change it to:

echo '<td><input type="text" name="'.$label.'"></td></tr>';

Attribute values should always be in quotations...
 
The problem could be within the include file not the code shown.

What is the error?

I see a possible problem in the line
echo "<td><input type=text name=$label; ></td></tr>";

this should be
echo "<td><input type=text name=".$label." ></td></tr>";
 
Back
Top