Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

MySQL data to popup menu

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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.

New php-forum User
New php-forum User
Posts: 14
Joined: Thu Oct 31, 2002 7:40 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>";
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.