MySQL data to popup menu

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 14
Joined: Thu Oct 31, 2002 7:40 am

Sun Nov 10, 2002 6:18 am


How can I create a popup select menu inside HTML that is content is dynamic (MYSQL field data). And how can I read the variable and use it.


Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sun Nov 10, 2002 9:10 am

Code: Select all

$query=mysql_query("SELECT id, caption FROM `location`");

echo"<form method=post action=pejone.php>  <select name=popupmenu size=1>";

while ($data=mysql_fetch_aray($query))
echo"    <option value=$data['id']>$data['caption']</option>";
echo " </select></form>";

Post Reply