i have this code:
<tr><td>Data expirare:</td><td><?=date_chooser("date",date("Y-m-d"),0)?></td></tr>
It is working properly, but at the moment I look from 1920 until 2050 and I want to show me only of certain pending and the next five years.
i have this code:
<tr><td>Data expirare:</td><td><?=date_chooser("date",date("Y-m-d"),0)?></td></tr>
It is working properly, but at the moment I look from 1920 until 2050 and I want to show me only of certain pending and the next five years.
I assume you are using the date_chooser() algorithm from this SO post: How to jump to anchor on submit - not to top of page or this internet page: http://ideone.com/Ab0cLD
I adapted a small part of the code by adding two variables: $from_year
and $to_year
. They do now define the range of the years in your drop down. You can the adapt the value of the variables to your needs.
$chooser.="<select name='".$name."year'>";
$from_year = 1950
$to_year = date("Y") + 5
for($i=$from_year;$i<=$to_year;$i++)
{
if($i==$year) $selected='selected';
else $selected='';
$chooser.="<option $selected>$i</option>";
}