Search Query: how to construct a search string from two select elements?

Im trying to create a wordpress search widget. The final search string Im trying to submit is made up of two keywords, one each from a select element.

I’d like the final search query to be ‘/search.php?s=first-select-element,second-select-element

Read More

Here’s the HTML form code at present:

<form class="" method="POST" action="" id="search-box">

            <ul class="">
                <li class="">
                    <label for="make">Make: </label>
                    <select name="make" id="make">
                        <option value="1">1</option>
                        <option value="2">2</option>
                    </select>
                </li>
                <li class="search model">
                    <label for="model">Model: </label>
                    <select name="model" id="model">
                        <option value="11">11</option>
                        <option value="12">12</option>
                    </select>
                </li>
                <li class="">
                    <input type="submit" class="btn" value="Search Motorcave">
                </li>
            </ul>
            </form>

I dont have any jQuery processing set up.

I’s like to avoid including any PHP in the header (every page) to detect and run this transformation, if possible – just return one clean string to WordPress’ search page.

I want the resulting query string from this form to end up like this:
(assuming the first item in each of the elements is selected):

http://example.com/?s=1,10

Does this make sense? What does everyone think the best method for achieving this is? A PHP processor in the head? Some crafty javascript that processes the form before submit, and concatenates the values into one new string?

Any help on this is greatly appreciated!

Rick, Melbourne AU.

Related posts