Jump to content

how can i fill a select box with years, that have passed and years to come


deansaddigh

Recommended Posts

This will give you a list of the years...

 

<select name="year">
<?php

$cur_year = date("Y");

for ($i = ($cur_year-10); $i <= ($cur_year+10); $i++)
{
    echo '<option value="'.$i.'">'.$i.'</option>';
}

?>
</select>

 

Do you need help with the querying side of things too?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.