Re: drop down menu
| From: | Jeremy Bettis | Date: | Fri, 06 Jul 2001 20:16:03 +0000 |
| Subject: | Re: drop down menu | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-8162@lists.php.net to get a copy of this message | ||
Here is an example using Pear::DB syntax:
<?php
$data = $dbh->getAll("select keyfield, descfield from table",
DB_FETCHMODE_ASSOC);
echo "<select name=device>\n";
foreach ($data as $row) {
echo "<option value=\"", $row["keyfield"],
"\">", $row["descfield"],
"</option>\n";
}
echo "</select>\n";
?>
--
Jeremy Bettis
jeremy+phpnews@deadbeef.com
"Pete Kuczynski" <pkuczyns@us.dhl.com> wrote in message
news:3B46105D.883A3703@us.dhl.com...
> The one line statment below, returns the contents of a cell from a mysql
> database.
>
> Would anyone know how I could change it to a drop down menu. Basically,
> I wan't to be able to query another table, and change devides via the
> drop down menu.
>
> Pete
>
> echo "<td align=right>Device: <input type=text name='device'
> value='$row->device'></td><tr>";
>
> --
> _______________________________________
> Pete Kuczynski
> Sr. Field Engineer
> DHL Airways Inc.
> Infrastructure Technology & Services
> (773)-462-9758
> 24/7 Helpdesk 1-800-434-5767