Re: Another Drop down question
| From: | szii at sziisoft dot com | Date: | Thu, 28 Mar 2002 01:45:21 +0000 |
| Subject: | Re: Another Drop down question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17966@lists.php.net to get a copy of this message | ||
The easiest way...
> $getlist = mysql_query("SELECT distinct Writer FROM stories");
> echo " <select name=\"WriterName\">\n";
echo "<option value='All'>Search All</option>";
> while ($row = mysql_fetch_array($getlist)) {
> echo ' <option
> value="'.$row["Writer"].'">'.$row["Writer"]."</option>\n";
> }
> echo " </select>\n";
-Szii
----- Original Message -----
From: "Kim Kohen" <kim@webguide.com.au>
To: "PHP" <php-db@lists.php.net>
Sent: Wednesday, March 27, 2002 5:18 PM
Subject: [PHP-DB] Another Drop down question
> Hello all,
>
> I'm trying for the first time to use a dynamically created popup menu from a
> mysql database. The menu is of (article) writers' names and will be used in
> a select query.
>
> Using snippets of code I've gleaned from here and the mysql list, I've the
> popup working fine but I'd like to include either a blank entry or a 'Search
> all Writers' entry in the menu and this is where I'm stuck.
>
> The code I have is:
>
> $getlist = mysql_query("SELECT distinct Writer FROM stories");
> echo " <select name=\"WriterName\">\n";
> while ($row = mysql_fetch_array($getlist)) {
> echo ' <option
> value="'.$row["Writer"].'">'.$row["Writer"]."</option>\n";
> }
> echo " </select>\n";
>
> If anyone could point me in the right direction or direct me to appropriate
> documentation I'd be most appreciative.
>
> Cheers and thanks
>
> kim
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php