|
Posted by Harry Haller on 10/10/05 00:20
Hello,
I'm using the book "Beginning PHP4" (Wrox) to learn PHP5. I have PHP
Version 5.0.5 installed, running on Win XP pro SP2 with IIS.
On page 265-269 3 files are described. The first menu1.php posts the
value of a combo box to menu2.php. The combo (posted) is called
ListBox1 and a typical value = "Pizza ($7)". menu2.php is supposed to
take the value posted and store it in a hidden form field (see below).
My debug while loop confirms that the value is being posted. The final
result - 2 variables (ListBox2 and Course1) are supposed to be
recieved by bill.php. The same while debug loop indicates that no
value for Course1 is being posted to bill.php. The errata file for
Wrox "Beginning PHP4" does not indicate an error.
What has gone wrong here and how can I fix it?
+ + + + +
menu2.php
+ + + + +
<HTML>
<HEAD><TITLE>Welcome to Charlie's dessert selection</TITLE></HEAD>
<BODY>
<?php
while (list($key, $value) = each($HTTP_POST_VARS))
{
echo "$key = $value<BR>";
}
echo "<HR>";
$Desserts=array("Apple Pie ($3)","Pancakes ($3)","Ice Cream ($2)");
echo "<FORM METHOD='POST' ACTION='bill.php'>";
echo "Which of the following would you like as a dessert?";
echo "<SELECT NAME='ListBox2'>";
echo "<OPTION SELECTED VALUE=''>Select...</OPTION>";
echo "<OPTION>$Desserts[0]</OPTION>";
echo "<OPTION>$Desserts[1]</OPTION>";
echo "<OPTION>$Desserts[2]</OPTION>";
echo "</SELECT><BR><BR>";
echo "<INPUT TYPE='HIDDEN' NAME='Course1' VALUE='$ListBox1'>";
echo "<INPUT TYPE='SUBMIT'>";
echo "</FORM>";
?>
</BODY>
</HTML>
Navigation:
[Reply to this message]
|