Copy link to clipboard
Copied
Hi Folks,
I am trying to get a drop down menu to populate in increments of 10 and I can't seem to get it. It must be easy but searching the net doesn't seem to get me anywhere.
here's what I have at present:
----------------------------------------------------------------
<select name="distance_miles" class="formrightcolumnnarrow" id="distance_miles">
<?php
for( $i=0; $i<=1000; $i++ )
{?>
<option value="<?php echo$i;?>"><?php echo$i;?>
<?php ;} ?>
</option>
</select>
----------------------------------------------------------------
if I do the obvious and change $i++ to $i+10 the browser hangs.
Can anyone give me a clue how to make it work for a higher increment than 1?
Cheers
Dave
$i++ is shorthand for $i=$i+1
So....
$i=$i+10
Copy link to clipboard
Copied
$i++ is shorthand for $i=$i+1
So....
$i=$i+10
Copy link to clipboard
Copied
Great thanks,
I am truly dumb.
Cheers
Dave
Copy link to clipboard
Copied
if I do the obvious and change $i++ to $i+10 the browser hangs. Can anyone give me a clue how to make it work for a higher increment than 1?
$i++ is an abbreviation for:
$i = $i + 1;
So, use:
$i = $i + 10;
HTH,
Randy
Copy link to clipboard
Copied
Dang, I need to refresh my list more often