date problem
i would like to let user enter their date of birth by providing list box for them to choose the year, month and date but i don't know how. So, i end up with the following code with is very long and uneffective. And for example, February only has 28/ 29 days but the user may choose 30 and 31 with my code.Is there a better way? Please provide me with the code. Thx.
D.O.B (yy, mm, day) <?php
echo " <select name=\"empDOByear\" tabindex=\"6\" id=\"textbox\">";
for($i=gmdate("Y"); $i>=1900 ; $i--)
{
echo "<option value=\"$i\" >$i </option>";
}
echo " </select>";
?>
<select name="empDOBmonth" tabindex="7" id="textbox2">";
<option value="01" >01</option>
<option value="02" >02</option>
<option value="03" >03</option>
<option value="04" >04</option>
<option value="05" >05</option>
<option value="06" >06</option>
<option value="07" >07</option>
<option value="08" >08</option>
<option value="09" >09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<?php
echo " <select name=\"empDOBday\" tabindex=\"8\" id=\"textbox3\">";
for($i=1; $i<=31; $i++)
{
echo "<option value=\"$i\" >$i </option>";
}
echo " </select>";
?><br><br>
Besides, if at another page i display the value of date retrieved from a query, how did i select the retrieved value while displaying other as well values to let the user update or change the data ?
|