dongsheng4679
2014-03-24 12:29
浏览 72
已采纳

如何使用ListBox通过GET方法发送多个变量

I would like to make a ListBox that can send 2 variables (called category and order) to shopping.php by GET method with single click on ListBox.

So that shopping.php can use the variables $_GET['category'] and $_GET['order']

How can I do that?

<form method="GET">
<select name="XXX" onchange="javascript: submit()">
  <option value="" selected="">Please select here</option>
  <option value="shopping.php?category=Dictionary&order=bookTitle">Order by book title</option>
  <option value="shopping.php?category=Dictionary&order=price">Order by price</option>
</select>
</form>
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dora0817 2014-03-24 12:31
    已采纳

    Change your code to

    <form method="GET">
    <input type="hidden" name="category" value="Dictionary">
    <select name="order" onchange="javascript: submit()">
      <option value="" selected="">Please select here</option>
      <option value="bookTitle">Order by book title</option>
      <option value="price">Order by price</option>
    </select>
    </form>
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题