kevincro Posted November 16, 2007 Share Posted November 16, 2007 What I want to do is take a number, for our purposes we'll use 10. I want to display the numbers 1-10 in a select box. The part that makes this difficult for me, is I want the number ten to come from a user input. In other words, if the user imputs the number 20 I want the select box to show numbers 1-20. The user would imput this number on a previous form and this number is saved along with other information in a database. I display this info on another page where the select box will be shown. I apologize if this request is hard to follow, but I don't know any other way to describe what I want. Thanks so much. KC Quote Link to comment https://forums.phpfreaks.com/topic/77590-solved-counter-help/ Share on other sites More sharing options...
rajivgonsalves Posted November 16, 2007 Share Posted November 16, 2007 here you go <?php $number = 10; echo "<select>"; for ($i=1;$i<=$number;$i++) { echo "<option value='$i'>$i</option>"; } echo "</select>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/77590-solved-counter-help/#findComment-392724 Share on other sites More sharing options...
kevincro Posted November 16, 2007 Author Share Posted November 16, 2007 Thank you very much, that worked perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/77590-solved-counter-help/#findComment-392729 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.