In your PHP you'll have access to the values that are posted. In this case it will be in $_POST['Year']
, $_GET['Year']
or $_REQUEST['Year']
, as Year
is the name of your select
.
The issue you have is that the select
is built by javascript, rather than PHP. Because of that you need to set it using javascript too. Therefore you need to get the data from PHP into javascript - does that make sense to you?
OK.
So what you need to do, is generate a call to a javascript function using PHP. When the browser receives and renders the page it will run the javascript and set the value.
An example might be:
$year = $_POST['Year'];
echo( "<script>$('#Year').val('$year')<\script>" );
This would depend on how your PHP outputs the pages (I.E. what frameworks you are using, etc)
However, by far the simplest solution would be be actually build the select
in PHP instead - if that's an option.