Re: Getting data from mysql db for html form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Gamco - Gawie Marais" <gawie@xxxxxxxxx> wrote in message
news:200406091404.i59E4TjH007936@xxxxxxxxxxxxxxxxxxxxxx
> 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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux