vidyashankara Posted June 16, 2006 Share Posted June 16, 2006 Lets say i have a variable $model if $model is 17, then i want a drop down box with 1,2,3,... 17 as the options how do i do that?right now i have the following code[code]echo "<select name=segidi> ";for ($i=0; $i<$model1; $i++) {echo "<option value=$model1[$i]>$model1[$i]";}echo "</select>";[/code]But this outputs 1 and 7 as the options. Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 16, 2006 Share Posted June 16, 2006 [code]echo "<option value='". $i. "'>". $i. "</option>";[/code] Quote Link to comment Share on other sites More sharing options...
vidyashankara Posted June 16, 2006 Author Share Posted June 16, 2006 [!--quoteo(post=384764:date=Jun 16 2006, 04:47 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 16 2006, 04:47 PM) [snapback]384764[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]echo "<option value='". $i. "'>". $i. "</option>";[/code][/quote]that outputs 0,1,2,... 16, how do i get it to output 1,2,3..17 ?[code]for ($i=1; $i<$model; $i++) {echo "<option value=$i>$i";}[/code]I did the aboce one and it outputs 1,2,3,.. 16 not 17what do i do? Quote Link to comment Share on other sites More sharing options...
joquius Posted June 16, 2006 Share Posted June 16, 2006 for ($i=1; $i<=$model; $i++) {echo "<option value=$i>$i";} 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.