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