Seeing as you said such nice things ... and you may not got what I was getting at...
PHP Code:
<h3>Pick a release year/month</h3>
<select name='year'>
<option value =''>Pick one</option>
<?php
$years = range( date('Y'), '1990');
foreach( $years as $y ){
echo"'<option value='$y'>$y</option>" . PHP_EOL ;
}
?>
</select>
<select name='month'>
<option value =''>Pick one</option>
<?php
$months = array('01'=>'Jan','02'=>'Feb','03'=>'Mar',// etc);
foreach( $months as $k=>$v ){
echo"'<option value='$k'>$v</option>" . PHP_EOL ;
}
?>
</select>
Then on the back end you can detect if month was selected (is month really necessary at all?) if it is not your sql can be
Code:
// say you filtered incoming value and assigned it to
// $year = 2005 ;
SELECT id, title
FROM films
WHERE YEAR(release_date) = $year ;
Otherwise if month is set you can simply do
Code:
// say you filtered incoming value and assigned it to
// $year = 2005 ;
// $month = '02' ; // NB this must remain a string!
$tgt = $year . '-' . $month ; // add together to make your target
SELECT id, title
FROM films
WHERE release_date LIKE '$tgt%'
// NB quote the LIKE string
Bookmarks