fife Posted October 22, 2010 Share Posted October 22, 2010 Hi I was just wondering if someone could send me a good tutorial on pulling several fields from a table and displaying them all in one drop down menu for people to select one of them. I dont know what this is called to I dont know what to research online. Quote Link to comment https://forums.phpfreaks.com/topic/216569-displaying-drop-down-menus/ Share on other sites More sharing options...
Pikachu2000 Posted October 22, 2010 Share Posted October 22, 2010 Is this what you're talking about? $query = "SELECT `id`, `name` FROM `table`"; $result = mysql_query($query); echo "<select name=\"select_field\">\n"; while( $array = mysql_fetch_assoc($result) ) { echo "<option value=\"{$array['id']}\">{$array['name']}</option>\n"; } echo "</select>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/216569-displaying-drop-down-menus/#findComment-1125265 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.