I have a form with 3 dropdowns, $year, $make, and $model. When a user selects a value out of one of the dropdowns I want to save it to a session variable. I am using onChange event on the form to reload the page and pass the value using $_GET (I am intentionally only passing 1 value at a time instead of all 3). When the page reloads, I want to save the passed variable to a $_SESSION variable for later use. This seems like this should be simple to do but it is not saving the value.
Here is how I am passing the value selected from the 3 dropdowns on the form (stripped down obviously):
Code: Select all
<select style="width: 90px;" tabindex="1" name="year" onchange="window.location= 'products.php?year='+this.value">
<select style="width: 90px;" tabindex="1" name="make" onchange="window.location= 'products.php?make='+this.value">
<select style="width: 90px;" tabindex="1" name="model" onchange="window.location= 'products.php?model='+this.value">Code: Select all
if ($_GET){
if ($_GET['year']) $_SESSION['year'] = $_GET['year'];
if ($_GET['make']) $_SESSION['make'] = $_GET['make'];
if ($_GET['model']) $_SESSION['model'] = $_GET['model'];
}