使用GET帮助搜索表单

时间:2009-11-17 19:28:27

标签: php

如果即时通讯:index.php?area=characters

并输入例如。搜索字段中的Agamemnon Busmalis

<h2>Search Character</h2>
<form action="?area=characters" method="get">
Name: <input type="text" name="name" />
</form>

我希望它发送给我:index.php?area=characters&name=Agamemnon+Busmalis

但它将我发送到:index.php?name = Agamemnon + Busmalis

为什么会这样?

1 个答案:

答案 0 :(得分:2)

添加隐藏的表单元素:

 <h2>Search Character</h2>
 <form  method="get">
 Name: <input type="text" action="form.html" name="name" />
 <input type="hidden" name="area" value="characters" />
 </form>