Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asp not running from html!

Status
Not open for further replies.

chassid

MIS
Aug 27, 2000
58
0
0
US
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 =&quot;VBSCRIPT&quot; %>
<html>
<head>
<title>Search Results!</title>
</head>

<body>
<%

Dim sqlSrch

Set dbGlobalWeb = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbGlobalWeb.Open(&quot;act1&quot;)

sqlSrch = &quot;SELECT * FROM act1&quot;

If Request.Form(&quot;TypeSearch&quot;) = &quot;Last&quot; Then
sqlSrch = sqlSrch & &quot; WHERE Last LIKE '%&quot; & Request.Form(&quot;DaInbox&quot;) & &quot;%'&quot;
End If

If Request.Form(&quot;TypeSearch&quot;) = &quot;Title&quot; Then
sqlSrch = sqlSrch & &quot; WHERE Title LIKE '%&quot; & Request.Form(&quot;DaInbox&quot;) & &quot;%'&quot;
End If

If Request.Form(&quot;TypeSearch&quot;) = &quot;Company1&quot; Then
sqlSrch = sqlSrch & &quot; WHERE Company1 LIKE '%&quot; & Request.Form(&quot;DaInbox&quot;) & &quot;%'&quot;
End If

If Request.Form(&quot;TypeSearch&quot;) = &quot;City&quot; Then
sqlSrch = sqlSrch & &quot; WHERE City LIKE '%&quot; & Request.Form(&quot;DaInbox&quot;) & &quot;%'&quot;
End If

If Request.Form(&quot;TypeSearch&quot;) = &quot;State&quot; Then
sqlSrch = sqlSrch & &quot; WHERE State LIKE '%&quot; & Request.Form(&quot;DaInbox&quot;) & &quot;%'&quot;
End If

Set rsGlobalWeb = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsGlobalWeb.Open sqlSrch, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>

<h2 align=&quot;center&quot;>We did not find a match!</h2>
<%Else%>


<%If Not rsGlobalWeb.BOF Then%>

<h2>Here are the results of your search:</h2>

<table BORDER=&quot;0&quot; width=&quot;100%&quot; cellpadding=&quot;3&quot;>
<tr>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Name </font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Title </font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Company Name</font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Address</font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>City</font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>State </font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>ZIP</font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Phone </font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>Fax </font></th>
<th bgcolor=&quot;#800000&quot;><font face=&quot;Arial&quot; color=&quot;#FFFFFF&quot;>E-mail </font></th>
</tr>
<%
Do While Not rsGlobalWeb.EOF
%>
<tr>
<td><%=rsGlobalWeb(&quot;First&quot;)%>
<%=rsGlobalWeb(&quot;Last&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Title&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Company1&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Address&quot;)%>
<%=rsGlobalWeb(&quot;Address2&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;City&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;State&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Zip&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Phone&quot;)%>
</td>
<td><%=rsGlobalWeb(&quot;Fax&quot;)%>
</td>
<td><a href=&quot;mailto:<%=rsGlobalWeb(&quot;Email&quot;)%>&quot;><%=rsGlobalWeb(&quot;Email&quot;)%></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=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot;>
<p><img src=&quot;header.gif&quot; width=&quot;400&quot; height=&quot;46&quot;> </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=&quot;mailto: ACTHQ@aol.com&quot;>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 &quot;Bank&quot; will return all companys with the word &quot;bank&quot;
in their name (e.g., &quot;Bank of America&quot;) The results of your search will be given
to you in a standard directory listing. </p>


<form action=&quot;engine.asp&quot; method=&quot;post&quot; name=&quot;dbmember&quot; align=&quot;center&quot;>
<p> </p>
<table border=3 cellspacing=0 cellpadding=3 bgcolor=#aeaeae width=95%>
<tr>
<td width=&quot;36%&quot;>Field to Search On:</td>
<td width=&quot;64%&quot;>
<select name=&quot;TypeSearch&quot; size=1 value=&quot;&quot;>
<option selected value =&quot;LastName&quot;>Last Name</option>
<option value=&quot;City&quot;>City </option>
<option value=&quot;State&quot;>State </option>
<option value=&quot;CompanyName&quot;>Company Name </option>
<option value=&quot;Title&quot;>Title </option>
</select>
</td>
</tr>
<tr>
<td width=&quot;36%&quot;>Search Criteria:</td>
<td width=&quot;64%&quot;>
<input type=&quot;text&quot; name=&quot;DaInbox&quot; size=40 maxlength=50 value=&quot;&quot;>
</td>
</tr>
</table>
<input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;submit&quot;>
<input type=&quot;reset&quot; name=&quot;reset&quot;>
</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=&quot;fixedform&quot; action=&quot;/cgi-bin/match.exe/actresult@act\actdir&quot; method=&quot;post&quot;>
<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=&quot;actfield&quot; onChange=&quot;update();&quot;>
<option value=&quot;x&quot; SELECTED>Select a Category:
<option value=&quot;Committee&quot;>Committee
<option value=&quot;Chapter Board&quot;>Chapter Board
<option value=&quot;National Board&quot;>National Board
<option value=&quot;Expert&quot;>Expertise
<option value=&quot;Chapter&quot;>Chapter
<option value=&quot;Council&quot;>Council
...
<hr noshade width=85%>
<h3>3. Entire Directory</h3>
To browse the entire directory, simply select the box below and press &quot;Go&quot;.


<form name=&quot;allform&quot; action=&quot;/cgi-bin/match.exe/actresult@act\actdir&quot; method=&quot;post&quot;>
<center>
<input type=&quot;checkbox&quot; value=&quot;Entire Database&quot; name=&quot;allmembers&quot;>
<input type=&quot;submit&quot; value=&quot;Go&quot; name=&quot;submit2&quot;>
</center>
</form>
<hr noshade size=3>
Return to <a href=&quot; Only</a>
page.
</body>
</html>

Please help me with this one,
Daniel
 
Yeah... you're missing the close tag on the first form, and that may be causing problems. Otherwise, you're going to the second form at the bottom of the page. Plus each form needs its own submit button, otherwise you're simply browsing your directory as in the second form. [sig]<p> <br><a href=mailto:aberman@thebiz.net>aberman@thebiz.net</a><br><a href= > </a><br>Database web programmer and developer, fueled by peach snapple and mochas.[/sig]
 
ASP is server-side therefore you have to save .asp page to the web server root dir (&quot;inetpub/ You can create your own folder inside.

hope this help, [sig]<p>Jun Nantes<br><a href=mailto:bhudz@junnantes.com>bhudz@junnantes.com</a><br><a href= Nantes Official Internet Site</a><br>[/sig]
 
chassid,
I agree with Jun about place to store your .asp file and there's something else:
1.get rid of [red]value=&quot;&quot;[/red] in <select> -- doesn't cause the problem, but just to be neat;
2.This is the copy of a line from your code :
If Request.Form(&quot;TypeSearch&quot;) = [red]&quot;Last&quot;[/red] Then
This line will always return false, because
<select> named &quot;TypeSearch&quot; doesn't have <option> element with value &quot;Last&quot; -- it's &quot;LastName&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top