RE: [PHP] Forms and While Loop
| From: | Jason Cox | Date: | Wed, 01 Nov 2000 22:44:44 +0000 |
| Subject: | RE: [PHP] Forms and While Loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23264@lists.php.net to get a copy of this message | ||
Of course the $CatID variable doesn't show in the action line. According to
your code, it is even defined until later in the script. I don't know
exactly what you're trying to do but this might work for you:
$row = mysql_fetch_row($result);
$CatID=$row[1];
echo "<p><form method=\"post\"
action=\"$Relative/items.php?CA=$CatID&UID=$UID\"><select
name=\"CatList\" size=\"1\">";
do
{
$Cat=$row[0];
$CatID=$row[1];
echo "<option value=\"$row[0]\"> $row[0] </option>";
} while ($row = mysql_fetch_row($result))
echo "</select><input type=\"submit\" name=\"Submit\"
value=\"Go to
Category\"></p></form>";
Jason
> -----Original Message-----
> From: Wayne Michel [mailto:wayne@michel.com.au]
> Sent: Wednesday, November 01, 2000 3:37 PM
> To: PHP List
> Subject: [PHP] Forms and While Loop
>
>
> I am trying to produce a drop-down list. Relevant (I think) code follows:
>
> echo "<p><form method=\"post\"
> action=\"$Relative/items.php?CA=$CatID&UID=$UID\"><select
> name=\"CatList\" size=\"1\">";
> while ($row = mysql_fetch_row($result))
> {
> $Cat=$row[0];
> $CatID=$row[1];
> echo "<option value=\"$row[0]\"> $row[0] </option>";
> }
> echo "</select><input type=\"submit\" name=\"Submit\"
> value=\"Go to
> Category\"></p></form>";
>
> It all works well except the variable $Cat is not showing in the action
> line. I have to get it to work with various layouts, but I am at an
> impasse. As a new PHP coder, I try to think it through, but this
> time I am
> stuck.
>
> Can anyone show me how to get the variable $Cat, inside the loop,
> to appear
> in the action line.
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
_______________________________________________________
Site Design, Hosting, and E-Commerce at www.webpipe.net