I have made a dropdown search option when visitors can select from several words and search for that. The problem is that with every word extra data is added. With one word it is /?s=keyword With 2 words it is /?s=keyword&sn=keyword2 but it should be /?s=keyword+keyword2 The form is as followed <form role="search" method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>"> <div> <label class="screen-reader-text" for="s">Search for:</label> Type <select name='s' id='type' class='postform' > <option value='' selected='selected'>All</option> <option class="level-0" value="dog">Dog</option> <option class="level-0" value="cat">Cat</option> </select> Color <select name='sn' id='color' class='postform' > <option value='' selected='selected'>All</option> <option class="level-0" value="red">red</option> <option class="level-0" value="white">white</option> <option class="level-0" value="green">green</option> </select> <input type="submit" id="searchsubmit" value="Search" /> </div> </form> Code (markup): Is there a way to replace &sn= with + ?
I'm looking at your form and you have named both your select as "s". Assuming you can only make a max of two choices, one of the selects should be named something else. I'm not sure where you are getting sn from. But maybe I'm misunderstanding something. How do you expect to get both variables from the URL with a + inbetween them?
You are right. I changed the second one to sn. The current url is /?s=keyword&sn=keyword2 So perhaps it is possible with with string replace or JS to change the secons &sn= to +