搜索表单问题

时间:2015-09-11 14:37:17

标签: php html wordpress

我需要在WP网站上建立一个搜索表单,而且我已经在这个问题上挣扎了一个星期,似乎无法找到合适的解决方案。

我现在有了这个代码:



<form role="search" method="get" id="searchform" action="http://www.doing-business-international.com/">
<div class="filterbox">
 <div class="search_group1">
    <label class="screen-reader-text-1" for="s">Country</label>
 <input type="text" value="" placeholder="" name="s" id="s" class="text_box_country"/>
</div>
<div class="search_group2">
 <label class="screen-reader-text-2" for="f">Expertise</label>
 <input type="text" value="" placeholder="" name="f" id="f" class="text_box_expertise"/>
</div>
 <div class="search_group3"> 
 <input type="submit" class="btn_double_search" id="searchsubmit" value="Search" />
 </div>
</div>
</form>
&#13;
&#13;
&#13;

我已经缩小了搜索结果,只是让它搜索标题而不是内容。

但是它显示了包含第一个或第二个搜索词的所有结果,我希望它只显示两者都有的结果。

网站为http://www.doing-business-international.com/

我还尝试将第一个搜索框更改为带有类别的下拉列表(因为所有国家/地区都是不同的类别,但输出的搜索结果非常奇怪:

http://www.doing-business-international.com/test

&#13;
&#13;
<form role="search" method="get" id="searchform" action="http://www.doing-business-international.com/">
  <div>
    <label class="screen-reader-text" for="s">In what country do you want to start your business?<br>Which expertise are you looking for?</label><br><br>
    <?php wp_dropdown_categories( 'show_option_all=Select a country&exclude=1'); ?>
     <input type="text" value="e.g. lawyer" name="s" id="s" class="text_box_expertise"/>
    <input type="submit" class="btn_double_search" id="searchsubmit" value="Search" />
  </div>
</form>
&#13;
&#13;
&#13;

第二个搜索选项是我的第一个想法,但是我无法让它工作,所以我切换到现在在网站上的搜索表单。

理想情况下,我想要一个包含国家(类别)的下拉框和旁边的类型搜索框。所以它只搜索选定的类别。

我很抱歉这个长期的问题,但我试图尽可能好地描述它(不是真正的编码)

希望有人有个主意。

0 个答案:

没有答案