phpme1221 Posted July 20, 2011 Share Posted July 20, 2011 Can someone help with a form drop down from an array? The array is not known until you print_r mean could be 2 could be 10 values in the array. Thanks Link to comment https://forums.phpfreaks.com/topic/242451-dropdown-menu-from-an-array/ Share on other sites More sharing options...
premiso Posted July 20, 2011 Share Posted July 20, 2011 Use foreach $dd = '<select name="selectnamehere"> foreach ($array as $item) { $dd .= '<option value="' . $item . "'>'. $item . '</option>'; } $dd .= '</select>'; echo $dd; Should get you started. Link to comment https://forums.phpfreaks.com/topic/242451-dropdown-menu-from-an-array/#findComment-1245245 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.