开发者

Go to page based on two menu selections

开发者 https://www.devze.com 2023-01-08 03:15 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消