dc_jt Posted June 7, 2007 Share Posted June 7, 2007 Hi I have the following drop down which is to display 1-12 for months January to December. (It also contains -- which means no month selected.) However, the months are displayed 1,2,3, 4 etc. How can I get it to be displayed like 01,02,03,04 etc?? I tried using printf but not sure whether Ive put it in the right place?? Thanks <select name="Endsdatem" class="fmgreynormal"> <? if ($_GET['iPhaseId'] && formatDate($oIndivualPhase->end_date) != '00/00/0000') { for ($i=1;$i<=12;$i++) {?><? echo "<option value=\"$i\""; if ($i == $EndaMonth) echo " selected"; echo ">".printf(">%02d</option>",$i); } ?> <option value="00">--</option> <?php } else { for ($i=1;$i<=12;$i++) { echo "<option value=\"$i\">$i</option>"; } echo "<option value=\"--\" selected>--</option>"; } ?> </select> 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.