# Autoincrement in menu/list in a form using php

**URL:** <https://forum.kirupa.com/t/autoincrement-in-menu-list-in-a-form-using-php/218557>\
**Category:** Uncategorized\
**Created:** [March 8, 2007, 7:58pm UTC](https://forum.kirupa.com/t/autoincrement-in-menu-list-in-a-form-using-php/218557 "2007-03-08T19:58:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiefrebelangel](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@chiefrebelangel](https://forum.kirupa.com/u/chiefrebelangel)\
**Post date:** [March 8, 2007, 7:58pm UTC](https://forum.kirupa.com/t/autoincrement-in-menu-list-in-a-form-using-php/218557/1 "2007-03-08T19:58:43Z")

</div>

good evening all :thumb2:

Im working on a project and i desperate need help. I want to use menu/list in a form and the data in the drodown menu should range from -60 to +60 and  
with a .25 between each number. As you can understand i dont want to  
input the data manually so i thought of making a loop which auto increment the value and display it dynamically in the menu list.

This is what i got

\<?php  
//Here i made the loop thingy just to display it on the page  
for testing purpose  
$i= -60;  
$k=0.25;  
while ($i!=60) {  
$i=$i+$k;  
print $i;  
print “\<br\>”;  
}  
?\>

\<?php  
//Then I tried to implement this somehow with my menulist and i get  
the inifinte loop trouble.The below code is example of that

?\>  
\<select name=“number”\>  
\<?php

```
  // Here we display the registered shops in database
  
  do {
  ?&gt;
    &lt;option value="&lt;?php echo $i;?&gt;" selected="selected"&gt;&lt;?php echo $i;?&gt;&lt;/option&gt;
    &lt;?php

```

}  
while ($i!=60);  
$i=$i+$k;

?\>  
\</select\>

I did something similar with retrieving data from a database and that worked easy but this is not, anyone could help me. :tb:

To end I just want to say that you all guys on here rocks.Keep up the good work
