lol,  Thanks for your help Alexander :)

-----Original Message-----
From: Alexander Skwar [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 10:17 AM
To: Peter Houchin
Cc: Php-General@Lists. Php. Net
Subject: Re: [PHP] Populating HTML List boxes From DB


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

Reply via email to