开发者

How to fill a drop down menu

I want to populate a drop down menu with a column from a MySQL database. I have the rest of my database set up, but at the moment it is just a text entry box and it would be easier just to select the actually entry from 开发者_如何学Pythona list. Also does anyone know of a good tutorial or site that has tutorials and example codes for PHP and MySQL


$result = // from the database

echo '<select name="foobars">';

while ($row = mysql_fetch_assoc($result))
{
   echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';
}

echo '</select>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜