hbk
hbk
Branch Unspecified
21 Jul 2008

populating drop down from MySQL

hi guys.

i hav this drop down menu, which i need to populate with data from one column of a particular table of MySQL dbase.

i hav read a lot on this, but have not been able to come up wid any code.
any and all help in this regard will be greatly appreciated.

thx a ton.
bayazidahmed

bayazidahmed

Branch Unspecified
10 years ago
using PHP?
hbk

hbk

Branch Unspecified
10 years ago
yes.... PHP = frontend, MySQL = backend...
bayazidahmed

bayazidahmed

Branch Unspecified
10 years ago
i am supposing that u know how to create a databse connection using php. and u have the required field from the table in a resource. If you dont then tell me.

<SELECT NAME="someName">
<?PHP
while($row = mysql_fetch_array($resource, MYSQL_ASSOC))
{
?>
<OPTION VALUE=<?PHP echo $row['field']; ?>><?PHP echo $row['field']; ?>
<?PHP
}
?>
</SELECT>

Share this content on your social channels -

Only logged in users can reply.