Re: Re: Dynamically populating a dropdown box
| From: | ST Ooi | Date: | Fri, 14 Dec 2001 00:22:25 +0000 |
| Subject: | Re: Re: Dynamically populating a dropdown box | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15017@lists.php.net to get a copy of this message | ||
or alternatively, you can download a drop down box populating class from
http://phpclasses.upperdesign.com/
----- Original Message -----
From: "Matthew Crouch" <whyyousee@yahoo.com>
To: <php-db@lists.php.net>
Sent: Friday, December 14, 2001 6:57 AM
Subject: [PHP-DB] Re: Dynamically populating a dropdown box
> I'm no expert, and my code is probably buggy, but I think this is the gist
of it:
>
> <select name="color">
> <?
> $result = mysql_query("SELECT * from colors");
> while ($myrow = mysql_fetch_array($result)) {
> printf("<option value=%s>%s</option>", $myrow["colorid"],
$myrow["colorname"]);
> }
> ?>
> </select>
>
>
> Chris Payne wrote:
>
> > Hi there everyone,
> >
> > I have a shopping cart which is starting to work nicely, but I have to
select size/color from the entries, how do I do this dynamically in PHP with
MySQL? I need them to be dropdown form boxes but haven't got a clue how to
populate them from the field
> s of my database.
> >
> > Please help me with example code if possible, it would be greatly
appreciated :-)
> >
> > Thank you everyone
> >
> > Regards
> >
> > Chris
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>