Go to page based on two menu selections
Javascript noob here (I'm assuming I will need Javascript to solve this).
I need to make a page which directs a user depending on the selection they make from two dropdown lists.
Lets say I have a form with two lists:
A contains
<option>1</option>
<option>2</option>
<option>3</option>
B contains
<option>1</option>
<option>2</option>
<option>3</option>
and for A I select 3 and for B I select 开发者_JAVA技巧1.
When I press submit, I want to link to www.example.com/example.php?a=3&b=1
How do I go about changing the link based on the two user selections?
Just put those menus inside one form that has the method set to GET:
<form action="example.php" method="get">
<!-- here your menus-->
<!-- this will create a button to send the data-->
<input type="submit" value="Go" />
</from>
Of course, you will have to properly name your <select>
elements:
<select name="a">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
If you do a HTTP GET, you should get that automatically from your form.
精彩评论