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" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php