You should not forget to add a name attribute on the select tag:
Code:
<select id="year" name="year">
Adding highlighted should return result.
If you intend to have no year selected by default, then just add an option tag:
JS:
Code:
<script type="text/javascript">
window.onload=function(){
var num = 100, // Set how many years from now you want to be seen.
d=new Date();
for(var i=((d.getFullYear())-num);i<=d.getFullYear();i++)
{
var opt=document.getElementById('year');
opt.options[opt.options.length]=new Option(i,'year'+i);
}
}
</script>
<label for="year">Year: </label>
<select id="year" name="year">
<option>---YEAR---</option>
</select>
PHP:
Code:
<label for="year">Year: </label>
<select id="year" name="year">
<option>---YEAR---</option>
<?php
$num = 100; // Set how many years from now you want to be seen.
$y=date('Y'); // Get the current year
for($i=($y-$num);$i<=$y;$i++)
echo '<option value="year'.$i.'">'.$i.'</option>';
?>
</select>
See if it helps.
Bookmarks