Support » Plugins » Hacks » 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

    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=>
    <input type=text style="width:350px" name=keywords>
    <input type=submit name=submit value=Search>

    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'); ?>">
                    <legend class="hidden">Search form</legend>
                    <div class="input-holder">
                        <input class="search" name="s" type="text" placeholder="Search Here"/>
                    <?php wp_dropdown_categories('show_option_all=Intranet&orderby=name&depth=1');?>
                    <button value="submit" class="search_btn">Search</button>

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    You should be able to set the name of the text input box using javascript, triggered by an onchange event of the dropdown. I’m not sure you can add events to wp_dropdown_categories(), so it’ll need to be recoded as html.

    Anyone able to help on this one? Looking back into it this week!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom search form passing search onto another site depending on dropdown…’ is closed to new replies.