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>