使用带有GET函数的窗体


Using a form with the GET function

我想知道是否有人能帮忙我正在尝试使用一个带有get函数的表单,但运气不太好。

这是我的代码

<div class="row-fluid search-forms search-default">
<form class="form-search" method="get" action="search_results.php">
<div class="chat-form">
<div class="input-cont">   
<input type="text"  placeholder="Search..." class="m-wrap" />
</div>
<button type="button" class="btn green">Search &nbsp; <i class="m-icon-swapright m-icon-white"></i></button>
</div>
</form>
</div>

搜索将我带到右侧页面,但在?q= 之后没有任何内容

知道吗?

您尚未为输入提供名称。因此,它没有任何可添加到GET中的内容。将属性name="添加到标记中。

您必须添加name="q":

<input type="text"  placeholder="Search..." name="q" class="m-wrap" />