Added ending date option

This commit is contained in:
jengo 2001-04-04 06:49:03 +00:00
parent 4b1282adcd
commit 003ef39d11

View File

@ -126,23 +126,40 @@
return $out;
}
function getYears($name, $selected=0, $startYear=0)
function getYears($name, $selected = 0, $startYear = 0, $endyear = 0)
{
if(!$startYear) $startYear = date('Y');
if (!$startYear)
{
$startYear = date('Y') - 2;
}
if (!$endyear)
{
$endyear = date('Y') + 5;
}
$out = '<select name="'.$name.'">'."\n";
$out .= '<option value=""';
if($selected == 0 OR $selected == '') $out .= ' SELECTED';
if ($selected == 0 OR $selected == '')
{
$out .= ' SELECTED';
}
$out .= '></option>'."\n";
for($i=$startYear - 1;$i<$startYear + 5;$i++)
// We need to add some good error checking here.
for ($i=$startYear;$i<$endyear; $i++)
{
$out .= '<option value="'.$i.'"';
if($selected==$i) $out .= ' SELECTED';
if ($selected==$i)
{
$out .= ' SELECTED';
}
$out .= '>'.$i.'</option>'."\n";
}
$out .= '</select>'."\n";
return $out;
}