Re: Populating HTML List boxes From DB
| From: | Alexander Skwar | Date: | Tue, 17 Apr 2001 00:17:14 +0000 |
| Subject: | Re: Populating HTML List boxes From DB | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48851@lists.php.net to get a copy of this message | ||
So sprach Peter Houchin am Tue, Apr 17, 2001 at 10:08:36AM +1000:
> 1: is there a way to populate a list box from a db?
Sure.
>
> 2: if some one could point me in the right direction, with out actually giving a example, as to
> how to go about it as i've
> got no idea
Uhm, no example? I'll try. ... failed *G*
<select name="Listbox" size="42"><?php
$query = "SELECT ListboxText, ListboxValue FROM Table";
$rs = mysql_select( $query );
while( $row = mysql_fetch_object( $rs ) ){
echo '<option value="';
echo htmlentities( $row->ListboxValue );
echo '">';
echo htmlentities( $row->ListboxText );
}
?></select>
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.digitalprojects.com | http://www.iso-top.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 2 hours 3 minutes