Jump to content

Need this dropdown to go to link


selliott

Recommended Posts

Hello, I have this code to generate a drop down list of years, but need to adjust it so that when a date is selected, it takes you to  /schedule?Year=(selected year here)  Thanks :)

 

$thisYear = date('Y');
$startYear = "2009";
$selectYear = ($thisYear);

print 'Year: <select name="Year">';
foreach (range($thisYear, $startYear) as $year) {
$selected = "";
if($year == $selectYear) 
{ 
	$selected = " selected"; 
}
print '<option' . $selected . '>' . $year . '</option>
';
}
print '</select>';

Link to comment
https://forums.phpfreaks.com/topic/190073-need-this-dropdown-to-go-to-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.