phppup Posted February 23, 2012 Share Posted February 23, 2012 If I use this code: $values = range(0, 10); echo "<select name=\"my_field\">\n"; foreach($values as $v) { echo "<option value=\"$v\">$v</option>\n"; }echo "</select>\n"; to generate a dropdown, it will offer options from 1 thru 10. Is there any way to make them increment by .50 (ie: 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, etc.? Quote Link to comment https://forums.phpfreaks.com/topic/257631-building-a-dropdown/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 23, 2012 Share Posted February 23, 2012 Of course you can. Did you read the documentation for range Quote Link to comment https://forums.phpfreaks.com/topic/257631-building-a-dropdown/#findComment-1320449 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.