想做一个多功能搜索框,不知道怎么实现,用的是wordpress程序
大致效果如图:
怎么弄都只执行最后一个框的关键词搜索,求各位大大赐教呀。WordPressPHP搜索

解决方案 »

  1.   

    1.<input name="s" id="s" type="text" />一定要有哦
    2.把SQL输出一下看下拼接是否正确
      

  2.   

    把各种 参数 提交 到服务器, 服务器程序拼接一下 SQL 语句,就OK 了
      

  3.   


               <form id="search" target="_blank" action="<?php bloginfo('url'); ?>"/>
    <input class="pinpai" type="text" name="s" id="s" value="品牌" onFocus="this.value='';" onBlur="if(this.value==''){this.value='品牌';}"/>
    <input class="chexi" type="text" name="s" id="s" value="车系" onFocus="this.value='';" onBlur="if(this.value==''){this.value='车系';}"/>
    <input class="jiage" type="text" name="s" id="s" value="价格范围" onFocus="this.value='';" onBlur="if(this.value==''){this.value='价格范围';}"/>
    <input class="guanjianci" type="text" name="s" id="s" value="关键词" onFocus="this.value='';" onBlur="if(this.value==''){this.value='关键词';}"/>
        <button class="search01" type="submit">搜索</button>
    </form>
      

  4.   


    <input name="s" id="s" type="text" />一个就够了吧。其他的通过后台获取变量后再拼接SQL
      

  5.   

    <form id="search" target="_blank" action="<?php bloginfo('url'); ?>"/>
    <input class="pinpai" type="text" name="pinpai" id="pinpai" value="品牌" onFocus="this.value='';" onBlur="if(this.value==''){this.value='品牌';}"/>
    <input class="chexi" type="text" name="chexi" id="chexi" value="车系" onFocus="this.value='';" onBlur="if(this.value==''){this.value='车系';}"/>
    <input class="jiage" type="text" name="jiage" id="jiage" value="价格范围" onFocus="this.value='';" onBlur="if(this.value==''){this.value='价格范围';}"/>
    <input class="guanjianci" type="text" name="keyword" id="keyword" value="关键词" onFocus="this.value='';" onBlur="if(this.value==''){this.value='关键词';}"/>
        <button class="search01" type="submit">搜索</button>
    </form>
    把name和id都唯一,后台用$_POST['name']来取值
      

  6.   

    初学,所以请教一下,关于这个$_POST['name']怎么写呢?拜托拜托!!在线等您。
      

  7.   

    $_POST['name']就是后台接收数据时候用的啊
    name是你前面input框的name值
    用这个试试吧
    if(isset($_POST['name'])){
       echo $_POST['name'];
    }
    发送表单的方式分为post和get两种,在<action method="post">里这样设定详细的可以去w3school看看
      

  8.   

    sql就能搞定了 $_post['文本框框名字']
      

  9.   

    http://www.w3school.com.cn/php/php_post.asp
    w3school的教程参考下吧
      

  10.   

    如果所有input 的name都是"s",那post过去只能得到最后的那个值,也就是关键词的。需要将每个input的name都改成不一样,然后后台使用$_POST['input的name']取得对应的值
      

  11.   

    如果是 使用Php做一个搜索框, 楼上已经给你了近乎详尽的做法了
    如果是 使用wordpress程序做一个搜索框,那么你需要先阅读 wordpress 的插件开发说明书