Jump to content

[SOLVED] for..loop question


watthehell

Recommended Posts

hi,

 

i was doing a for.. loop which comes at 10 interval and populate a list box,

 

can anyone guide me

i write this didn't work

 

 <? for($i=10;$i<=60;$i++){?>
	 <option value="<?=$i+9;?>"><? echo $i;?></option>
	 <? }?>

the output should be like this

00

10

20

30

40

50

 

any help.. plz

Link to comment
https://forums.phpfreaks.com/topic/69321-solved-forloop-question/
Share on other sites

Thanks a lot

 

<?php
for ($i=0; $i<60; $i+=10)
{
     printf ("<option value='%02d'>%02d</option>\n", $i, $i);
}
?>

 

Can you explain this please

printf ("<option value='%02d'>%02d</option>\n", $i, $i);

 

what is %02d for

 

anyway thanks it worked..

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.