[thelist] PHP: display leading zero
Lauri Väin
optima at hot.ee
Thu Oct 5 01:20:47 CDT 2000
Hello everybody,
Originally sent this to hwg-languages at hwg.org, but got no responses.
<SNIP>
I'd like to list the numbers 01-31 to a drop down list(select box).
The code I'm using:
//////////////////////// snip
<SELECT name="kuup2ev">
<OPTION value="<?$kuup2ev = 01; echo $kuup2ev;?>" selected>
<?echo $kuup2ev;?>
</OPTION>
<? $date_select = $kuup2ev; while($date_select < 32) { ?>
<OPTION value="<?echo $date_select; ?>"><?echo $date_select;?></OPTION>
<? $date_select++; } ?>
</SELECT>
//////////////////////// snip
Now, instead of:
01
02
03
04
...
I get:
1
2
3
4
...
The question: How can I make PHP display the leading zero in case the number is
only one digit?
</SNIP>
Thanks,
Lauri
More information about the thelist
mailing list