Re: Getting data from mysql db for html form
| From: | Gawie Marais | Date: | Thu, 10 Jun 2004 07:45:40 +0000 |
| Subject: | Re: Getting data from mysql db for html form | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34695@lists.php.net to get a copy of this message | ||
works like a bomb !!!
thanx man !
"Torsten Roehr" <roehr@zilleon.com> wrote in message
news:20040609174612.92107.qmail@pb1.pair.com...
> "Gamco - Gawie Marais" <gawie@gam.co.za> wrote in message
> news:200406091404.i59E4TjH007936@lightning.gam.co.za...
> > Hi,
> >
> > Could someone help me out here...
> >
> > I have a mysql database with a table that conatains names. I am setting
up
> a
> > html form and I would like to create a multi-listing with those names so
> > that you can choose one and then submit the form.
>
>
> // open db connection...
>
> $result = mysql_query("SELECT name FROM table");
>
> echo '<select name="names">';
>
> while ($row = mysql_fetch_assoc($result)) {
>
> echo '<option>' . $row['name'] . '</option>';
> }
>
> echo '</select>';
>
> Haven't tested it. Change 'name' to the name of your table column.
>
> Regards,
>
> Torsten Roehr