如何正确写搜索框,以及搜索框传值的问题
<form name="f" action="/index.php/s/wd/">
<input type="text" name="wd" maxlength="100" value="Wordpress">
<input type="submit" value="Search">
</form>
这是一个搜索框
如果将搜索的值传到方法页面
怎么写才是正确 的?
楼主的 action="/index.php/s/wd/" 是相对路径,如果是最好写个在前面加个action="<?=base_url()?>/index.php/s/wd/"
那么在s.php中写
public function wd()
{
echo $this->input->post('wd',TRUE);
} $this->input->post() 如果是post传值的化就是这个方法啊 action="<?php echo site_url('s/wd');?>" 搜索功能的话,建议用GET方式吧。简单些就用分段传值就行了。用POST的话,搜索出来的信息量多的话,你分页之后的数据就会有问题的。
页:
[1]