在表单提交</select>上通过url传递<select>的值

时间:2014-01-20 17:43:39

标签: html forms

我有一个简单的表单,我想通过url传递用户选择。

<form method="GET" action="course-registration.asp">
<select>
 <option value="#">--Select--</option>
 <option value="courseOfferings[special_1005][item_1]=January%2030-31,%202014&course=ArcCHECK / 3DVH Product Training&date=January 30-31, 2013&description=This hands-on product training course focuses on the use of the ArcCHECK 3-dimensional beam dosimetry QA system with 3DVH software.">January 30-31, 2014</option>                 
</select>
<input type="submit" value="Submit">
</form>

如果我警告select的值,它会正确显示,但按下按钮时它不会传递给url。

1 个答案:

答案 0 :(得分:1)

您需要为select元素命名

喜欢<select name="dept">

<form method="GET" action="course-registration.asp">
   <select name="something">
     <option value="#">--Select--</option>
     <option value="cof">January 30-31, 2014</option>                 
  </select>
 <input type="submit" value="Submit">
</form>

这将使您的网址看起来像“http://some.co/?something=manything