0

所以我的确切问题是,我有一个选择表格。那里有 4 个选项,值分别为 1、2、3 和 4。选择旁边有一个按钮表单。每当我单击该按钮时,它应该将我导航到选择表单的选定选项的位置(例如 index.php?page=1)。我怎么解决这个问题?由于 php 的服务器端机制等原因,我已经读过它是不可能的,但必须有一种方法.. 到目前为止,我已经为按钮设置了 onclick 事件,例如...: location.href='index.php ?page=.. 里面发生了什么..

4

2 回答 2

0

它会起作用的

<select id="some_id">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select>
<button type="button" onclick="window.location.href='index.php?page='+document.getElementById('some_id').value;">Go</button>
于 2013-06-23T21:26:25.927 回答
0

一个正常的 GET 表单应该可以工作。

<form action="index.php" method="get">
    <select name="page">
        <option value="1">Page Name</option>
        ...
    </select>
    <input type="submit" value="Submit">
</form>
于 2013-06-23T21:31:31.277 回答