I have created a search function that searchs through a database based on a field you select from a listbox and the criteria you have entered.
Whenever I load the asp page alone I get the whole database. Which is what I expected.
Now, when I load the html page which will call the asp page once I enter my search criteria, the html doesn't run the asp and show the searches it obtained, it gives a screen where I can choose to download the asp from my computer!
What am I doing wrong? I call the asp page by writing on the html form action = engine.asp.
Here is my asp page and later the html. Please if anyone could help I would apreciate it!<%@ LANGUAGE ="VBSCRIPT" %>
<html>
<head>
<title>Search Results!</title>
</head>
<body>
<%
Dim sqlSrch
Set dbGlobalWeb = Server.CreateObject("ADODB.Connection"
dbGlobalWeb.Open("act1"
sqlSrch = "SELECT * FROM act1"
If Request.Form("TypeSearch" = "Last" Then
sqlSrch = sqlSrch & " WHERE Last LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "Title" Then
sqlSrch = sqlSrch & " WHERE Title LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "Company1" Then
sqlSrch = sqlSrch & " WHERE Company1 LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "City" Then
sqlSrch = sqlSrch & " WHERE City LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "State" Then
sqlSrch = sqlSrch & " WHERE State LIKE '%" & Request.Form("DaInbox" & "%'"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset"
rsGlobalWeb.Open sqlSrch, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>
<h2 align="center">We did not find a match!</h2>
<%Else%>
<%If Not rsGlobalWeb.BOF Then%>
<h2>Here are the results of your search:</h2>
<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Title </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Company Name</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Address</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">City</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">State </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">ZIP</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Phone </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Fax </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">E-mail </font></th>
</tr>
<%
Do While Not rsGlobalWeb.EOF
%>
<tr>
<td><%=rsGlobalWeb("First"%>
<%=rsGlobalWeb("Last"%>
</td>
<td><%=rsGlobalWeb("Title"%>
</td>
<td><%=rsGlobalWeb("Company1"%>
</td>
<td><%=rsGlobalWeb("Address"%>
<%=rsGlobalWeb("Address2"%>
</td>
<td><%=rsGlobalWeb("City"%>
</td>
<td><%=rsGlobalWeb("State"%>
</td>
<td><%=rsGlobalWeb("Zip"%>
</td>
<td><%=rsGlobalWeb("Phone"%>
</td>
<td><%=rsGlobalWeb("Fax"%>
</td>
<td><a href="mailto:<%=rsGlobalWeb("Email"%>"><%=rsGlobalWeb("Email"%></a> </td>
</tr>
<% rsGlobalWeb.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>
</body>
</html>
Now the html:
<html>
<head>
<title>ACT Membership Directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<p><img src="header.gif" width="400" height="46"> </p>
<p>The ACT Online Directory contains contact information on ACT Members. You must
have a browser that is javascripting enabled to use the directory searches.
There are three ways to view the ACT Directory. </p>
<ol>
<li>Perform a search by Name, Company, City, or State.
<li>Perform a search for ACT Members by Chapter, Committe, Board of Directors,
or Chapter Board Position.
<li>Browse the names and phone numbers of all listed ACT Members.
</ol>
<p>The instructions for doing each of these are listed below. If you see any discrepencies
in the directory, please send correction requests to: <a href="mailto: ACTHQ@aol.com">ACTHQ@aol.com</a>.
</p>
<hr noshade size=3>
<h3>1. Standard Search</h3>
<p>Please select the field in the ACT Directory you want to search on, and then
enter your search criteria. The Company and Title search do a Sounds Like search
so that the Company criteria "Bank" will return all companys with the word "bank"
in their name (e.g., "Bank of America" The results of your search will be given
to you in a standard directory listing. </p>
<form action="engine.asp" method="post" name="dbmember" align="center">
<p> </p>
<table border=3 cellspacing=0 cellpadding=3 bgcolor=#aeaeae width=95%>
<tr>
<td width="36%">Field to Search On:</td>
<td width="64%">
<select name="TypeSearch" size=1 value="">
<option selected value ="LastName">Last Name</option>
<option value="City">City </option>
<option value="State">State </option>
<option value="CompanyName">Company Name </option>
<option value="Title">Title </option>
</select>
</td>
</tr>
<tr>
<td width="36%">Search Criteria:</td>
<td width="64%">
<input type="text" name="DaInbox" size=40 maxlength=50 value="">
</td>
</tr>
</table>
<input type="submit" value="Search" name="submit">
<input type="reset" name="reset">
</center>
</form>
<p> </p>
<p>
<hr noshade width=85%>
<h3>2. Specialized Search</h3>
Select a category from the left text box. Then, select a field to search on from
the right text box. The search box will not work unless a selection is made from
both boxes. Finally, select 'Search' to look up the ACT Members.
<form name="fixedform" action="/cgi-bin/match.exe/actresult@act\actdir" method="post">
<table border=0 cellspacing=0 cellpadding=10 width=100%>
<tr>
<td><b>Search Category</b></td>
<td><b>Search Criteria</b></td>
<td><br>
</td>
</tr>
<tr>
<td width=200>
<select name="actfield" onChange="update();">
<option value="x" SELECTED>Select a Category:
<option value="Committee">Committee
<option value="Chapter Board">Chapter Board
<option value="National Board">National Board
<option value="Expert">Expertise
<option value="Chapter">Chapter
<option value="Council">Council
...
<hr noshade width=85%>
<h3>3. Entire Directory</h3>
To browse the entire directory, simply select the box below and press "Go".
<form name="allform" action="/cgi-bin/match.exe/actresult@act\actdir" method="post">
<center>
<input type="checkbox" value="Entire Database" name="allmembers">
<input type="submit" value="Go" name="submit2">
</center>
</form>
<hr noshade size=3>
Return to <a href=" Only</a>
page.
</body>
</html>
Please help me with this one,
Daniel
Whenever I load the asp page alone I get the whole database. Which is what I expected.
Now, when I load the html page which will call the asp page once I enter my search criteria, the html doesn't run the asp and show the searches it obtained, it gives a screen where I can choose to download the asp from my computer!
What am I doing wrong? I call the asp page by writing on the html form action = engine.asp.
Here is my asp page and later the html. Please if anyone could help I would apreciate it!<%@ LANGUAGE ="VBSCRIPT" %>
<html>
<head>
<title>Search Results!</title>
</head>
<body>
<%
Dim sqlSrch
Set dbGlobalWeb = Server.CreateObject("ADODB.Connection"
dbGlobalWeb.Open("act1"
sqlSrch = "SELECT * FROM act1"
If Request.Form("TypeSearch" = "Last" Then
sqlSrch = sqlSrch & " WHERE Last LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "Title" Then
sqlSrch = sqlSrch & " WHERE Title LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "Company1" Then
sqlSrch = sqlSrch & " WHERE Company1 LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "City" Then
sqlSrch = sqlSrch & " WHERE City LIKE '%" & Request.Form("DaInbox" & "%'"
End If
If Request.Form("TypeSearch" = "State" Then
sqlSrch = sqlSrch & " WHERE State LIKE '%" & Request.Form("DaInbox" & "%'"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset"
rsGlobalWeb.Open sqlSrch, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>
<h2 align="center">We did not find a match!</h2>
<%Else%>
<%If Not rsGlobalWeb.BOF Then%>
<h2>Here are the results of your search:</h2>
<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Name </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Title </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Company Name</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Address</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">City</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">State </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">ZIP</font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Phone </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">Fax </font></th>
<th bgcolor="#800000"><font face="Arial" color="#FFFFFF">E-mail </font></th>
</tr>
<%
Do While Not rsGlobalWeb.EOF
%>
<tr>
<td><%=rsGlobalWeb("First"%>
<%=rsGlobalWeb("Last"%>
</td>
<td><%=rsGlobalWeb("Title"%>
</td>
<td><%=rsGlobalWeb("Company1"%>
</td>
<td><%=rsGlobalWeb("Address"%>
<%=rsGlobalWeb("Address2"%>
</td>
<td><%=rsGlobalWeb("City"%>
</td>
<td><%=rsGlobalWeb("State"%>
</td>
<td><%=rsGlobalWeb("Zip"%>
</td>
<td><%=rsGlobalWeb("Phone"%>
</td>
<td><%=rsGlobalWeb("Fax"%>
</td>
<td><a href="mailto:<%=rsGlobalWeb("Email"%>"><%=rsGlobalWeb("Email"%></a> </td>
</tr>
<% rsGlobalWeb.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>
</body>
</html>
Now the html:
<html>
<head>
<title>ACT Membership Directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<p><img src="header.gif" width="400" height="46"> </p>
<p>The ACT Online Directory contains contact information on ACT Members. You must
have a browser that is javascripting enabled to use the directory searches.
There are three ways to view the ACT Directory. </p>
<ol>
<li>Perform a search by Name, Company, City, or State.
<li>Perform a search for ACT Members by Chapter, Committe, Board of Directors,
or Chapter Board Position.
<li>Browse the names and phone numbers of all listed ACT Members.
</ol>
<p>The instructions for doing each of these are listed below. If you see any discrepencies
in the directory, please send correction requests to: <a href="mailto: ACTHQ@aol.com">ACTHQ@aol.com</a>.
</p>
<hr noshade size=3>
<h3>1. Standard Search</h3>
<p>Please select the field in the ACT Directory you want to search on, and then
enter your search criteria. The Company and Title search do a Sounds Like search
so that the Company criteria "Bank" will return all companys with the word "bank"
in their name (e.g., "Bank of America" The results of your search will be given
to you in a standard directory listing. </p>
<form action="engine.asp" method="post" name="dbmember" align="center">
<p> </p>
<table border=3 cellspacing=0 cellpadding=3 bgcolor=#aeaeae width=95%>
<tr>
<td width="36%">Field to Search On:</td>
<td width="64%">
<select name="TypeSearch" size=1 value="">
<option selected value ="LastName">Last Name</option>
<option value="City">City </option>
<option value="State">State </option>
<option value="CompanyName">Company Name </option>
<option value="Title">Title </option>
</select>
</td>
</tr>
<tr>
<td width="36%">Search Criteria:</td>
<td width="64%">
<input type="text" name="DaInbox" size=40 maxlength=50 value="">
</td>
</tr>
</table>
<input type="submit" value="Search" name="submit">
<input type="reset" name="reset">
</center>
</form>
<p> </p>
<p>
<hr noshade width=85%>
<h3>2. Specialized Search</h3>
Select a category from the left text box. Then, select a field to search on from
the right text box. The search box will not work unless a selection is made from
both boxes. Finally, select 'Search' to look up the ACT Members.
<form name="fixedform" action="/cgi-bin/match.exe/actresult@act\actdir" method="post">
<table border=0 cellspacing=0 cellpadding=10 width=100%>
<tr>
<td><b>Search Category</b></td>
<td><b>Search Criteria</b></td>
<td><br>
</td>
</tr>
<tr>
<td width=200>
<select name="actfield" onChange="update();">
<option value="x" SELECTED>Select a Category:
<option value="Committee">Committee
<option value="Chapter Board">Chapter Board
<option value="National Board">National Board
<option value="Expert">Expertise
<option value="Chapter">Chapter
<option value="Council">Council
...
<hr noshade width=85%>
<h3>3. Entire Directory</h3>
To browse the entire directory, simply select the box below and press "Go".
<form name="allform" action="/cgi-bin/match.exe/actresult@act\actdir" method="post">
<center>
<input type="checkbox" value="Entire Database" name="allmembers">
<input type="submit" value="Go" name="submit2">
</center>
</form>
<hr noshade size=3>
Return to <a href=" Only</a>
page.
</body>
</html>
Please help me with this one,
Daniel