php drop down detect selection
<p>I have a date of birth, and when the user is over Feb (02), the days should go only to 29. As you can see I'm using <code>$month="1"</code> just to test it. I'm supposed to use PHP only, no JavaScript or anything else. How would i go about making that?</p>

<pre><code>&lt;?php
$month="1"; // &lt;-- currently using this to make it 29,30 or 31 days

print "&lt;select name='day'&gt;";
if  ($month==1){
    for ($i=0; $i&lt;=28; $i++)    
    {
        $day = 1 + $i;
        print "&lt;option value = $day&gt;" . $day ."&lt;/option&gt;";
    }
}
if  ($month==2){
    for ($i=0; $i&lt;=29; $i++)
    {
        $day = 1 + $i;
        print "&lt;option value = $day&gt;" . $day ."&lt;/option&gt;";
    }
}


print "&lt;/select&gt;";

print "&lt;select name='month'&gt;";
for ($i=0; $i&lt;=11; $i++)
{

    $month = 1 + $i;
    print "&lt;option value = $month&gt;" .$month ."&lt;/option&gt;";
}
print "&lt;/select&gt;";
</code></pre>

<p>?></p>
