JTxx Posted January 9, 2010 Share Posted January 9, 2010 Lets say for arguments sake that i have a table which contains the numbers 1 to 10. How can i get a drop down list to pull these numbers from the table? So if i then added more numbers to the table then these would automatically appear in the list aswell... Link to comment https://forums.phpfreaks.com/topic/187895-populate-drop-down-list-from-table/ Share on other sites More sharing options...
Kalland Posted January 10, 2010 Share Posted January 10, 2010 You must query the database and fetch the data. Then iterate through the resultset. Link to comment https://forums.phpfreaks.com/topic/187895-populate-drop-down-list-from-table/#findComment-992073 Share on other sites More sharing options...
redarrow Posted January 10, 2010 Share Posted January 10, 2010 array example to help you.... <?php $array=array(1,2,3,4,5,6,7,8,9,10); echo"<select name='num'>"; foreach($array AS $numbers){ echo "<option value='$numbers'>$numbers</option>"; } echo"</select>"; ?> Link to comment https://forums.phpfreaks.com/topic/187895-populate-drop-down-list-from-table/#findComment-992126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.