I need a form to pass a search query to the search page with 2 options for the search but just one textbox.
I need something like a drop down box to choose between the 2 type of searches that will alter the name of the textbox before passing the query on.
The textbox for the search variable should be named "search" to search a directory and named "q" to query a meta engine
Can anyone help ?
eg
http://www.schok.co.uk/index.php?search=cd+player
would search the directory (textbox on form is named "search")
http://www.schok.co.uk/index.php?q=cd+player
would search the meta engine (textbox on form is named "q")
I have tried a javascript for this but it doesn't quite work
Could this could be changed to a PHP version ?
<script LANGUAGE="JavaScript">
<!-- Begin
site = "http://www.schok.co.uk/index.php";
function combineMenus(frm, menu1, menu2) {
with (frm) {
str = menu1.options[menu1.selectedIndex].value;
str += menu2.value;
url = site + str;
top.location.href = url;
//navigate(url);
}
}
// End -->
<form name=menufrm>
<select name=menu1>
<option value="?search=" selected>Directory</option>
<option value="?q=">Web search</option>
</select>
<input type="text" name="menu2" value="">
<input type=button value="Select" onClick="combineMenus(this.form, this.form.menu1, this.form.menu2)">
</form>
http://www.schok.co.uk/