I have the following code that redirects the page (onchange) based on the value of option’s choice.
For example we are in index.php. There is a select list and if the user chooses Design that has value “one” the redirected page will be the same page but with different url ( index.php&one )
My goal is to have the selected option, selected after the redirection/refresh.
Here is my code
<select size="1" name="Products"
onchange="if(this.options.selectedIndex>0) window.location.href = 'index.php&'+this.options [this.options.selectedIndex].value">
<option value="">Please Select a Product</option>
<option value="one">Design
Software</option>
<option value="two">Manufacturing
Software</option>
<option value="three">Machine Tools</option>
</select>
Thanks for your time
A solution with javascript and jQuery framework:
Keep in mind that you have to change the
&to?and set a parameter and a value. likeoption=one.So the corresponding javascript must change to this:
Demo: http://lb.vg/969f6