MySQL data to popup menu

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

MySQL data to popup menu

Postby ashz » Sun Nov 10, 2002 6:18 am

Hi,

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.

Thanks.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » 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>";


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron