Forum Moderators: open
The problem is that when someone decides to change the first option list value, the second select option needs to be reset to its default value...
So if user selects Category 1 the script queries and returns results. If the user selects Sub-Category 2, the script now narrows down the results and returns the results. BUT... if the user selects Category 2, the Sub-Category selection remains and there are no results returned. I want to reset the sub-category select list to 'any' when the user changes the first select.
What is the best way to do this? I thought maybe moving totally to chained selects but this way works except for this one issue that one of you might be able to help me with...
Alternatively, can anyone suggest a good chained select script for PHP where the select lists are built from my MYSQL queries (which I have already built).
Thanks gurus...
Here is the code:
<form action="" method="get">
<select name="cat" onChange="this.form.submit();">
<option value="any" selected>Any</option>
<option value = "1">Category 1</option>
<option value = "2">Category 2</option>
</select>
<select name="subcat" onChange="this.form.submit();">
<option value="any" selected>Any</option>
<option value = "sub1">Sub-Category 1</option>
<option value = "sub2">Sub-Category 2</option>
</select>
<input name="Search" type="submit" />
</form>