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... Quote Link to comment 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. Quote Link to comment 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>"; ?> Quote Link to comment 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.