Custom search form passing search onto another site depending on dropdown…
-
OK, we are building an Intranet using wordpress and the template has its search bar on the header, with a drop down allowing selection of specific post category to search or search everything (renamed to Intranet) we dont need the category search,
If you see the screenshot we would just like to have the drop down to have the Intranet option to search the wordpress site (cant link to it, its internal)
Heres what I need help with though…I would like to add a second option to the dropdown that changes the search to pass a query onto an external site and seach , the external site being http://www.qifv.scot.nhs.uk/CE_ClinicalGuidelines.asp
The seach form on this site actions CE_SearchResults.asp. The input of the form name is “keywords”
Now this code on an internal page allows this to optn up the external site with my search results,
<form method=post action=http://www.qifv.scot.nhs.uk/CE_SearchResults.asp> <input type=text style="width:350px" name=keywords> <input type=submit name=submit value=Search> </form>
So the code on the wordpress search form is,
<div id="search_right"> <div id="search_bg"> <form class="searchform" method="get" action="<?php echo get_option('home'); ?>"> <fieldset> <legend class="hidden">Search form</legend> <div class="input-holder"> <input class="search" name="s" type="text" placeholder="Search Here"/> </div> <?php wp_dropdown_categories('show_option_all=Intranet&orderby=name&depth=1');?> <button value="submit" class="search_btn">Search</button> </fieldset> </form> </div> </div>
As you can see from this section, is the dropdown
<?php wp_dropdown_categories('show_option_all=Intranet&orderby=name&depth=1');?>
Also the form input name in wordpress is “s” so the external site doesnt recognise that unless its name is Keywords but I cant change that which in turn breaks wordpress search.
So is there a way to have that drop down with 2 options, Intranet (search the wordpress as it is) and Clinical Guideliens option which will pass the query onto “action=http://www.qifv.scot.nhs.uk/CE_SearchResults.asp” with the input field name “keywords” , but ONLY if the “Clinical Guidelines” option is selected from the dropdown? Not sure if it can be done with an IF or something?
If anyone could help with this that would be great, let me know If im making no sense!!
Screenshot oft the site this needs to be on witht he searchbox (as its a localhost site) can be seen here http://www.codingforums.com/showthread.php?p=1252847#post1252847
- The topic ‘Custom search form passing search onto another site depending on dropdown…’ is closed to new replies.