I am using Dreamweaver 8 with ASP VB Script. IIS and localhost.
I have a search page, a database and a results page.
I have set up a search page with this code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Key Word Search</title><style type="text/css"><!--
body { background-color: #000000;
}
.style1 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-weight: bold;
}
--></style><script type="text/JavaScript"><!--
function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == '');
}
//--></script></head><body><form action="data_base_results.asp" method="get" name="search" target="_blank" id="search"> <div align="center"> <p class="style1">Key Word Search:</p> <p class="style1"> <label> <input name="keyword" type="text" id="keyword" value="<%= Request.QueryString("search") %>" size="30" maxlength="30" /> </label> <input name="Submit" type="submit" onclick="MM_validateForm('keyword','','R');return document.MM_returnValue" value="Submit" /> <input name="Reset" type="reset" id="Reset" value="Reset" /> </p> </div></form></body></html>
The data base is set up and tested OK with the following:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\inetpub\wwwroot\sciweb_root\sciencelinkcafe11kj.mdb"
The results page is set up and tested OK using the following code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/connSciWeb.asp" --><%
Dim rsSearch__MMColParam
rsSearch__MMColParam = "1"
If (Request.QueryString("search") <> "") Then rsSearch__MMColParam = Request.QueryString("search")
End If
%><%
Dim rsSearch
Dim rsSearch_numRows
Set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.ActiveConnection = MM_connSciWeb_STRING
rsSearch.Source = "SELECT KeyWords, Link, Year FROM Table1 WHERE KeyWords LIKE '%" + Replace(rsSearch__MMColParam, "'", "''") + "%' ORDER BY Year ASC"
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 1
rsSearch.Open()
rsSearch_numRows = 0
%><%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rsSearch_numRows = rsSearch_numRows + Repeat1__numRows
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Search Results</title><style type="text/css"><!--
body { background-color: #000000;
}
.style2 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 14px;
}
.style3 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF;
}
body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;
}
a:link { color: #000000; text-decoration: none;
}
a:visited { color: #000000; text-decoration: none;
}
a:hover { text-decoration: underline; color: #000000;
}
a:active { text-decoration: none;
}
#Layer1 { position:static; width:775px; height:25px; z-index:1; left: 541px; top: 270px; background-color: #00FFFF; color: #000000; padding-top: 10px;
}
.style5 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 14px; color: #000000; }
.style7 {color: #000000}
--></style></head><body><div align="center"> <p class="style3"> </p> <p class="style3">HERE ARE THE RESULTS OF YOUR KEYWORD/S SEARCH: </p> <p class="style3"> </p> <table border="2" cellpadding="2" cellspacing="5"> <tr bgcolor="#999999"> <td width="164" height="40" bordercolor="#FF0000"><div align="center" class="style2">Keyword/s</div></td> <td width="164" bordercolor="#FF0000"><div align="center">Year</div></td> </tr> <% While ((Repeat1__numRows <> 0) AND (NOT rsSearch.EOF)) %> <tr> <td height="22" bordercolor="#FF0000" bgcolor="#00FFFF"><div align="center" class="style2"><%= LCase((rsSearch.Fields.Item("KeyWords").Value)) %></div></td> <td bordercolor="#FF0000" bgcolor="#00FFFF"><div align="center"><%=(rsSearch.Fields.Item("Year").Value)%></div></td> </tr> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 rsSearch.MoveNext()
Wend
%> </table> <p> </p> <table width="853" border="2" cellpadding="2" cellspacing="5"> <tr bordercolor="#FF0000" bgcolor="#999999"> <td width="164" height="40"><div align="center" class="style7"><a href="data_base_search.asp" class="style2">Search again </a></div></td> <td width="110"> </td> <td width="115"> </td> <td width="200"> </td> <td width="200" height="40"><div align="center" class="style7"><a href="index.html"><span class="style2">Return home </span></a></div></td> </tr> </table></div></body></html><%
rsSearch.Close()
Set rsSearch = Nothing
%>
When the results page is tested the following comes up:
Can anyone help me? Help very gratefully received. Kev