Link to home
Start Free TrialLog in
Avatar of m0tSiE
m0tSiE

asked on

Send search query in URL, eg. ...search.php?query=blah

Hi,

I'm currently using the attached code to search a certain page depending on the dropdown chosen, at present, the code sends the user to the search results page with the query hidden from the url. His it possible for someone to modify this code so that the search term is shown in the URL?

EG.

The user searches for "test", so the url they are returned to would be "search.php?q=test".

Note: The javascript below sets the url they are returned to depending on what dropdown box is chosen.

Thanks,
Paul
<script type="text/javascript"><!--
function setAction(theForm){
  theForm.action = theForm.evt.value+theForm.trigger.value+".php";
}
--></script>
 
<form name='search' id='theSearchForm' method='post' onSubmit='setAction(this)' >
<input type='hidden' name='trigger' value='search_caws' >
<input type='text' name='search' size=25 maxlength=25 >
<select name='evt'>
<option value='http://cawsearch.com/impact/'>TNA iMPACT</option>
<option value='http://cawsearch.com/svr2008/'>Smackdown vs RAW 2008</option>
<option value='http://cawsearch.com/firepro/'>Fire Pro Wrestling Returns</option>
<option value='http://cawsearch.com/dor2/'>Day Of Reckoning 2</option>
<option value='http://cawsearch.com/wm21/'>WrestleMania 21</option>
</select>
<input type='Submit' name='search_caws' value='CAWSearch' onClick='this.form.trigger.value=this.name;' >
<input type='Submit' name='lucky' value='I&#39m Feeling Lucky' onClick='this.form.trigger.value=this.name;' >
</form>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of AielloJ
AielloJ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m0tSiE
m0tSiE

ASKER

Cheers :D