Adding more years? | Peter's Sports League Standings | Forum
Back to the sports standings script page


Adding more years?
Here's the code for the expanded year dropdowns as given to Jason, although this forum strips the indents:
admin_files/add_score.php
<select name="year[]">
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '">' . $outputyear . '</option>';
}
?>
</select>
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '">' . $outputyear . '</option>';
}
?>
</select>
admin_files/edit_score.php
<select name="year">
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '"';
if( $year == $outputyear )
{
print ' selected="selected"';
}
print '>' . $outputyear . '</option>';
}
?>
</select>
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '"';
if( $year == $outputyear )
{
print ' selected="selected"';
}
print '>' . $outputyear . '</option>';
}
?>
</select>