Submit Search with Form

[Total: 0    Average: 0/5]

This script shows how to setup a form to search a database.

Body Code:

<!-- SECTION I - SEARCH BOX-->
<form name="form1" method="get" action="search.html">
<input type="text" name="search">
<input type="hidden" name="mem_id" value="1000">
<input type="hidden" name="type" value="S">
<input type="submit" name="Submit" value="Submit">
</form>
<!-- END -->

<br>
<br>

<!-- SECTION II - SEARCH RESULTS-->
<script language="JavaScript">
<!-- Begin
var page_location = 'http://www.MYDOMAIN.com/search.html';
var idx = document.URL.indexOf('?'); var params = new Array();
if (idx != -1) { var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {nameVal = pairs[i].split('='); params[nameVal[0]] = nameVal[1];}}
mem_id = unescape(params["mem_id"]); type = unescape(params["type"]); search = unescape(params["search"]); pgcount = unescape(params["pgcount"]); document.write("<SCRIPT LANGUAGE=JavaScript1.2 SRC=http://www.brainysearch.com/search/push/?search=" + search + "&pgcount=" + pgcount + "&mem_id=" + mem_id + "&page_location=" + page_location + "&type=" + type + " TYPE=text/javascript></SCRIPT>");
//End -->
</script>
<!-- END -->

Times Viewed: 3

Leave a Reply

Your email address will not be published. Required fields are marked *