PDA

View Full Version : Drop Down Change Form Action - Multiple Search Engines



Notepad
03-23-2008, 09:05 PM
Hello,

I'm wondering if anyone has experience using javascript or PHP to facilitate switching between search engines with the select tag.

I've created & populated several different Google Custom Engines and need to enable a select (dropdown) form to search each one as wanted.

Here's a working form for one of the engines:

<form name="form1" action="/search_results1.php" id="searchbox_000728331164281115855:5ctdneheiqs" onSubmit="return checkform(this);">
<input type="hidden" name="cx" value="000728331164281115855:5ctdneheiqs">
<input type="hidden" name="cof" value="FORID:11">
<select name="as_qdr" class="selecttime">
<option value="all">anytime</option>
<option value="d">past 24 hours</option>
<option value="w">past week</option>
<option value="m">past month</option>
<option value="y">past year</option>
</select><input class="input" type="text" name="q" size="38" value="">
<input type="image" name="sa" src="images/0044.gif" class="imgbtn">
</form>
The above code has several common attributes (3 of them unique) shared by the other engines:

1) each has a unique results page (eg the action=)

2) the id="searchbox_000728331164281115855:5ctdneheiqs"

3) the name "cx" with a value="000728331164281115855:5ctdneheiqs"

4) <input type="hidden" name="cof" value="FORID:11">


There are three unique, defining attributes for each individual search form; the action, cx value and the searchbox id are different for each engine.

1) the URL of the results page(s)

2) the <input type="hidden" name="cx" value="000728331164281115855:5ctdneheiqs">

3) id="searchbox_000728331164281115855:5ctdneheiqs"


Combining 3 engines, here's a dummy example dropdown:


<form name="form1" action="http://www.mywebsite.net/" onSubmit="return checkform(this);">
<select name="unknown" class="selectcat">
<option value="search_results1.php?cx=000728331164281115855:lyebabibzz0&cof=FORID:11">Search Engine 1</option>
<option value="search_results2.php?cx=000728331164281115855:qkr33obxwoy&cof=FORID:11">Search Engine 2</option>
<option value="search_results3.php?cx=000728331164281115855:5ctdneheiqs&cof=FORID:11">Search Engine 3</option>
</select><input class="input" type="text" name="q" size="38" value="">
<select name="as_qdr" class="selecttime">
<option value="all">anytime</option>
<option value="d">past 24 hours</option>
<option value="w">past week</option>
<option value="m">past month</option>
<option value="y">past year</option>
</select><input type="image" name="sa" src="images/0044.gif" class="imgbtn">


Any help would be most appreciated; I've been all over the Web including Google's CSE groups, etc. for weeks to no avail.


# # #