tags for the HTML select box, with the # tag representing the currently selected year marked as selected. # $optionTags = array_pad(array(), 2001 - 1990 + 1, null); for($i = 1990; $i < 2001 + 1; ++$i) { if ($i == $selectedYear) { $optionTags[$i - 1990] = "$i"; } else { $optionTags[$i - 1990] = "$i"; } } $selectYearOptions = join("", $optionTags); ?>