Fw: [PHP-DB] Drop down list
| From: | George Lioumis | Date: | Wed, 30 Jan 2002 09:50:37 +0000 |
| Subject: | Fw: [PHP-DB] Drop down list | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16304@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: George Lioumis
To: B.J.Rumsey
Sent: Wednesday, January 30, 2002 11:47 AM
Subject: Re: [PHP-DB] Drop down list
Try the following:
<?php
$option_block = "";
$get_list = "select * from <table_name>";
$res = mysql_query($get_list) or die (mysql_error());
while ($row = mysql_fetch_array($res))
{
$artid= $row["artist_id"];
$art = $row["artist"];
$option_block .= "<OPTION value=\"$art_id\">$art</OPTION>";
}
?>
<SELECT name="artist">
<?php echo "$option_block"; ?>
</SELECT>
----- Original Message -----
From: B.J.Rumsey
To: php-db
Sent: Wednesday, January 30, 2002 10:17 AM
Subject: [PHP-DB] Drop down list
I have two fields artist_id, artist. How do I put the contents of "artist" into
a dropdown list.
____________________________________________________
IncrediMail - Email has finally evolved - Click Here