在搜索表单上发送多个选择查询的最佳做法是什么?

时间:2012-04-24 09:14:53

标签: php forms

我在搜索表单上使用Chosen Multiple Select

示例:

enter image description here

发送和发送的最佳做法是什么?在我的搜索表单上选择多个query string

2 个答案:

答案 0 :(得分:3)

我想将html设为<input type="hidden" name="chosen[]" value="<!-- id or whatever you want to work with-->" />

如果你可以通过选择的东西,那就是。

然后你可以在服务器端获得一个数组:

$arr = $_POST['chosen'];

print_r($arr);

array(0 => 2,
      1 => 10,
      2 => 37)

如果您选择了ID 2,10和37,则给出结果。

答案 1 :(得分:3)

您应该查看序列化:http://php.net/serialize 然后将您的输入命名为name =“choose []”以将其作为数组

进行选择