I have a date in my form code and want to set the default dates in the drop down boxes to todays date ... I currently have the following form code.
What do I need to add to position each drop down box to todays date?
Many thanks in advance... I am sure this is simple to experts out there - but I don't know how to do this.... Regards, Val
<tr><td class="tdadminb"><?=$this -> text['date_prob']?></td><td td colspan="2" class="tdadminb">
<?
$day = date("j");
$month = date("m");
$year = date("Y");
?>
<select name="day">
<?
for($i = 1; $i <= 31; $i ++)
{
echo("<option>$i</option>");
}
?>
</select>
<select name="month">
<option value="1"><?=$this -> text['jan']?></option>
<option value="2"><?=$this -> text['feb']?></option>
<option value="3"><?=$this -> text['mar']?></option>
<option value="4"><?=$this -> text['apr']?></option>
<option value="5"><?=$this -> text['may']?></option>
<option value="6"><?=$this -> text['jun']?></option>
<option value="7"><?=$this -> text['jul']?></option>
<option value="8"><?=$this -> text['aug']?></option>
<option value="9"><?=$this -> text['sep']?></option>
<option value="10"><?=$this -> text['oct']?></option>
<option value="11"><?=$this -> text['nov']?></option>
<option value="12"><?=$this -> text['dec']?></option>
</select>
<select name="year">
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
</select>
</td></tr>
What do I need to add to position each drop down box to todays date?
Many thanks in advance... I am sure this is simple to experts out there - but I don't know how to do this.... Regards, Val
<tr><td class="tdadminb"><?=$this -> text['date_prob']?></td><td td colspan="2" class="tdadminb">
<?
$day = date("j");
$month = date("m");
$year = date("Y");
?>
<select name="day">
<?
for($i = 1; $i <= 31; $i ++)
{
echo("<option>$i</option>");
}
?>
</select>
<select name="month">
<option value="1"><?=$this -> text['jan']?></option>
<option value="2"><?=$this -> text['feb']?></option>
<option value="3"><?=$this -> text['mar']?></option>
<option value="4"><?=$this -> text['apr']?></option>
<option value="5"><?=$this -> text['may']?></option>
<option value="6"><?=$this -> text['jun']?></option>
<option value="7"><?=$this -> text['jul']?></option>
<option value="8"><?=$this -> text['aug']?></option>
<option value="9"><?=$this -> text['sep']?></option>
<option value="10"><?=$this -> text['oct']?></option>
<option value="11"><?=$this -> text['nov']?></option>
<option value="12"><?=$this -> text['dec']?></option>
</select>
<select name="year">
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
</select>
</td></tr>
Comment