我有一个搜索表单,我想$ _ReQUEST搜索条件作为一个数组,所以我可以列出每个搜索术语,包裹每个术语的样式.我怎么做?
编辑:这是请求的代码.
<form action="http://localhost/wordpress" id="search" method="get">
<input type="text" size="30" id="s" name="s" value="Type and hit enter" onfocus="javascript:this.value='';" onblur="javascript:this.value='Type and hit enter';"/>
<br/>
<input type="submit" value="Search"/>
</form>
Run Code Online (Sandbox Code Playgroud)
更新:谢谢大家的回复.我会用爆炸,看起来相当简单.加上名字听起来很酷^^
形式如下:
<input type="text" name="terms[]" />
<input type="text" name="terms[]" />
<input type="text" name="terms[]" />
Run Code Online (Sandbox Code Playgroud)
在表单处理器中:
<? foreach($_REQUEST['terms'] as $term) { ?>
<span style="searchterm"><?= htmlspecialchars($term) ?></span>
<? } ?>
Run Code Online (Sandbox Code Playgroud)