|
Posted by Harry Haller on 10/10/05 06:25
On Sun, 09 Oct 2005 22:45:58 +0100, Philip Ronan
<invalid@invalid.invalid> wrote:
>"Harry Haller" wrote:
>
>(snip)
>> What has gone wrong here and how can I fix it?
>>
>> <?php
>>
>> while (list($key, $value) = each($HTTP_POST_VARS))
>> {
>> echo "$key = $value<BR>";
>> }
>> echo "<HR>";
>>
>(snip)
>> echo "<INPUT TYPE='HIDDEN' NAME='Course1' VALUE='$ListBox1'>";
>
>Am I right in assuming $ListBox1 is a variable posted from the last form? If
>so, you should include some code to set this variable in the PHP code. At
>the moment you're just listing the POST vars without setting anything.
>
>Try inserting another line into your while() loop like this:
>
> {
> echo "$key = $value<BR>";
> $key = $value;
> }
OK ppl, I figured it out. PHP5 default settings in php.ini are
incompatible with PHP4.
http://www.ineasysteps.com/updates/PHP_Form_Variables.pdf
I modified my code to use the $_POST[] array.
<HTML>
<HEAD><TITLE>Welcome to Charlie's dessert selection</TITLE></HEAD>
<BODY>
<?php
$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='" .
$_POST["ListBox1"] . "'>";
echo "<INPUT TYPE='SUBMIT'>";
echo "</FORM>";
?>
</BODY>
</HTML>
[Back to original message]
|