Re: Dropdown menus from DB query
| From: | Ng Hwee Hwee | Date: | Fri, 18 Jun 2004 01:09:10 +0000 |
| Subject: | Re: Dropdown menus from DB query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34829@lists.php.net to get a copy of this message | ||
hmm... what about something like this??
echo "<select name=\"dropdown\">;
$query = "select code, name from table";
$result = mysql_query($query);
while($array = mysql_fetch_array($result))
{
echo "<option
value=\"".$array["code"]."\">".$array["name"]."</option>";
}
echo "</select>";
hth
----- Original Message -----
From: "Cole Ashcraft" <cole.ashcraft@ashcraftfamily.net>
To: <php-db@lists.php.net>
Sent: Friday, June 18, 2004 7:50 AM
Subject: [PHP-DB] Dropdown menus from DB query
> How would you create a drop down menu from a database query? I have
> figured how to do it with one field, but how could it be done with a
> system where the value is different than the displayed value (ie.
> numerical code as the value, name displayed)?
>
> Thanks,
> Cole