Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

drop box

Codes here !

Moderators: macek, egami, gesf

drop box

Postby border20 » Mon Feb 17, 2003 7:46 am

How would i populate a drop box with the content of a mysql databse ?
New php-forum User
New php-forum User
Posts: 32
Joined: Tue Jan 28, 2003 10:19 am
Location: Québec

Postby Redcircle » Mon Feb 17, 2003 8:03 am

Code: Select all
$query = 'select id,content from table';
$request = mysql_query($query);
echo '<select name="form_select">';
while($row = mysql_fetch_array($result))
echo '<option value="'.$row['id'].'">'.$row['content'].'</option>';
echo '</select>';
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

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