/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getYearOptions( $selected, $offset, $count ) { $options = ''; $finish_year = $start_year + $count; for( $x = $start_year; $x <= $finish_year; $x++ ) { $options .= '<option value="' . $x . '"'; if( $x == $selected ) { $options .= ' selected="selected"'; } $options .= '>' . $x . '</option>'; } return $options; }