MySQL data to popup menu

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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


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: 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 Adsense [Bot] and 6 guests