Hi guys and gals,
I am using the following code as a searchbox at the top of my site.
<form name="classic" method="post" action="error.php">
Quicksearch: <input name="INPUT" id="INPUT" type="text" value="" />
<select name="countries" onchange="updatecities(this.selectedIndex); document.classic.action=(this.value)">
<option value="" selected>Choose a category</option>
<option value="search1.php">Category One</option>
<option value="search2.php">Category Two</option>
<option value="search3.php">Category Three</option>
<option value="search4.php">Category Four</option>
</select>
<select name="cities">
</select>
<input type="image" name="search" src="search.png" />
</form>
<script type="text/javascript">
var countrieslist=document.classic.countries
var citieslist=document.classic.cities
var cities=new Array()
cities[0]=""
cities[1]=["A|Avalue"]
cities[2]=["B|bvalue", "C|cvalue", "D|dvalue", "E|evalue"]
cities[3]=["F|fvalue", "G|gvalue"]
cities[4]=["H|hvalue", "J|jvalue"]
function updatecities(selectedcitygroup){
citieslist.options.length=0
if (selectedcitygroup>0){
for (i=0; i<cities[selectedcitygroup].length; i++)
citieslist.options[citieslist.options.length]=new Option(cities[selectedcitygroup][i].split("|")[0], cities[selectedcitygroup][i].split("|")[1])
}
}
</script>
This gives me a different secondary dropdown box, based on what is selected in the first box, and then fires off what the user types into INPUT to the relevant search page.
This is included in a seperate php file, and included on every page of my site. My question is, is there a way, once the next page has been loaded to retain the drop down and secondary drop down that were selected by the user, rather that it resetting to the default 'Choose Category'?