dpo15099 2015-09-11 14:37
浏览 36

搜索表单问题

I need to build a search form for on a WP website, and I've been struggling with it for a week now, can't seem to find the right solution.

I have this code now:

<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>

I already narrowed the search results down by only letting it search in the titles instead of content aswell.

But it displays all results with the first or second searchword in it, where I want it to display only the results where it has both.

Website is http://www.doing-business-international.com/

I also tried to change the first search box into a dropdown with categories (as all the countries are different categories, but then the outputted search results get really weird:

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

<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>

This second search option would was my first idea, but I can't get it to work, so I switched to the search form as it is now on the website.

So ideally, I want a drop-down box with countries (categories) and a type-seach box next to it. So it only searches in the selected categorie.

I am sorry for the long question, but I tried to describe it as good as possible (not really that into coding )

Hope anyone has an idea.

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?