HI! I have a small search feature, I guess it's more like just querying some tables. Right now people just pick from a drop down menu and choose something, like Windows 2000, it will show all the Windows 2000 articles. What I want to do, is add a keyword search so instead of choosing Windows NT from a drop down menu, they can also type in a text box "NT" and it will show everything with an "NT" in the results. Here is the first page of code:
<cfif #ParameterExists(Cookie.USERID)# IS "NO">
<cfinclude template="login.cfm">
<cfabort>
<cfelse>
</cfif>
<CFSET TITLE = "Tech Tips Search">
<!--- <CFINCLUDE TEMPLATE="_header.cfm"> --->
<CFQUERY datasource="2029_ACC_85005_Procedures" NAME="GetTips">
SELECT *
FROM tblCategory
</CFQUERY>
<html>
<head>
<title>Campus Only Web Forms</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<BODY BGCOLOR=#000033 TEXT="silver" LINK="blue" VLINK="purple">
<table border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#000066" width=620 height="372">
<tr>
<td width="15" height="77"> </td>
<td height="77"> </td>
<td align="right" height="77"> <font face="Myriad Web, Verdana, Helvetica" size="+2"><br>
<b><font size="+3">Campus Only</font></b><br>
</font> <font face="Times"><br>
<i>Restricted to Campus Personnel<br>
</i></font> </td>
<td width="50" height="77"> </td>
</tr>
<tr>
<td height="35" colspan="4" bgcolor="#ffffff">
<table width="98%" border="0">
<tr>
<td width="22%" height="45"><IMG alt="" border=0 height=75 src="../../images/CS_LOGO.jpg" width=93></td>
<td width="78%" height="45">
<blockquote>
<FORM action=results.cfm method=post>
<P><font color="Black" face="Arial, Helvetica, sans-serif" size="2"><b>Choose
by Category:</b></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
<BR>
</font>
<P><font color="Black" face="Arial, Helvetica, sans-serif" size="2">Tech
Tip Categories</font><font face="Arial, Helvetica, sans-serif" size="2"><BR>
<SELECT name=Keyword>
<OPTION selected><font color="Black">Choose </font>
<CFOUTPUT QUERY="GetTips">
<OPTION
value=#CategoryID#>#CategoryName#</OPTION>
</cfoutput>
</SELECT>
</font></P>
<p><font color="Black" face="Arial, Helvetica, sans-serif" size="2">Number
of records to display per page:</font> <font face="Arial, Helvetica, sans-serif" size="2">
<SELECT name=records_to_display>
<OPTION
selected>5
<OPTION>10
<OPTION>20
<OPTION>30
<OPTION>40</OPTION>
</SELECT>
</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="2"><BR>
<INPUT type=submit value=Search>
<BR>
</font> </p>
<P><font face="Arial, Helvetica, sans-serif" size="2"><A href="../../content/TechTips/TECHTIPS.htm">Show
all Tech Tips</A> </font>
</FORM>
</blockquote>
</td>
</tr>
<tr>
<td width="22%"> </td>
<td width="78%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="84" colspan="4" bgcolor="#ffffff">
<DIV align=left><IMG alt="" border=0 height=69 src="../../images/4_web.jpg" width=338><br></DIV>
</td>
</tr>
<tr>
<td height="21" colspan="4">
<p> </p></td></tr>
</table><cfinclude template="_footer.cfm">
<div align="center"><br>
</div>
</BODY>
</html>
Results Page:
<HTML>
<HEAD>
<TITLE>Results Page</TITLE>
<!-- This Query retrieves the tech tips from the database -->
<CFQUERY DATASOURCE="2029_acc_85005_procedures" NAME="RetreiveInfo">
SELECT A.*, B.CategoryName
FROM tbltips A, tblcategory B
WHERE A.CategoryID=B.CategoryID AND B.CategoryID='#Keyword#'
</CFQUERY>
<!-- If the user access this page for the first time, we set the_start value at 1 -->
<CFPARAM NAME="the_start" DEFAULT="1">
<!-- If the the_start is already defined, then we had 5 to it to calculate the value of next_start -->
<CFIF ISDEFINED("the_start"
>
<CFSET NEXT_START = #THE_START# + #RECORDS_TO_DISPLAY#>
</CFIF>
</HEAD>
<BODY>
<CFOUTPUT>
There are <b>"#RetreiveInfo.RecordCount#" </b>records in the Database.<BR><BR>
</CFOUTPUT>
<TABLE CELLPADDING="2" CELLSPACING="2">
<TH>Row</TH><TH>Category Name</TH><TH>Question</TH><TH>Provided By</TH>
<CFOUTPUT QUERY="RetreiveInfo" STARTROW="#the_start#" MAXROWS="#records_to_display#">
<TR>
<TD ALIGN="center">#CurrentRow#</TD>
<TD>#CategoryName#</TD>
<td><A HREF="#Article#">#Question#</A></td>
<TD>#ProvidedBy#</TD>
</TR>
</CFOUTPUT>
</TABLE>
<CFOUTPUT>
<!-- the previous button will not be displayed if there's no more record left to display before this page -->
<CFIF #THE_START# IS NOT 1>
<A HREF="results.cfm?the_start=#Evaluate(the_start - records_to_display)#&records_to_display=#records_to_display#&Keyword=#Keyword#">Previous #records_to_display#</A>
</CFIF>
<!-- the next button will not be displayed if there's no more record left to display after this page -->
<CFIF #NEXT_START# LTE RETREIVEInfo.RECORDCOUNT>
<!-- If the next page is the last one, we check how many records are left and display the right count inside the link -->
<CFIF #EVALUATE(NEXT_START + #RECORDS_TO_DISPLAY# - 1)# GT RETREIVEInfo.RECORDCOUNT>
<CFSET NEXT_RECORDS_COUNT = #RETREIVEInfo.RECORDCOUNT# MOD #RECORDS_TO_DISPLAY#>
<A HREF="results.cfm?the_start=#next_start#&records_to_display=#records_to_display#&Keyword=#Keyword#">Next #next_records_count#</A>
<CFELSE>
<A HREF="results.cfm?the_start=#next_start#&records_to_display=#records_to_display#&Keyword=#Keyword#">Next #records_to_display#</A>
</CFIF>
</CFIF>
</CFOUTPUT>
</BODY>
</HTML>
I'm not sure how to incorporate a simple keyword search... Any assitance is appreciated. Thanks,
Lisa
<cfif #ParameterExists(Cookie.USERID)# IS "NO">
<cfinclude template="login.cfm">
<cfabort>
<cfelse>
</cfif>
<CFSET TITLE = "Tech Tips Search">
<!--- <CFINCLUDE TEMPLATE="_header.cfm"> --->
<CFQUERY datasource="2029_ACC_85005_Procedures" NAME="GetTips">
SELECT *
FROM tblCategory
</CFQUERY>
<html>
<head>
<title>Campus Only Web Forms</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<BODY BGCOLOR=#000033 TEXT="silver" LINK="blue" VLINK="purple">
<table border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#000066" width=620 height="372">
<tr>
<td width="15" height="77"> </td>
<td height="77"> </td>
<td align="right" height="77"> <font face="Myriad Web, Verdana, Helvetica" size="+2"><br>
<b><font size="+3">Campus Only</font></b><br>
</font> <font face="Times"><br>
<i>Restricted to Campus Personnel<br>
</i></font> </td>
<td width="50" height="77"> </td>
</tr>
<tr>
<td height="35" colspan="4" bgcolor="#ffffff">
<table width="98%" border="0">
<tr>
<td width="22%" height="45"><IMG alt="" border=0 height=75 src="../../images/CS_LOGO.jpg" width=93></td>
<td width="78%" height="45">
<blockquote>
<FORM action=results.cfm method=post>
<P><font color="Black" face="Arial, Helvetica, sans-serif" size="2"><b>Choose
by Category:</b></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
<BR>
</font>
<P><font color="Black" face="Arial, Helvetica, sans-serif" size="2">Tech
Tip Categories</font><font face="Arial, Helvetica, sans-serif" size="2"><BR>
<SELECT name=Keyword>
<OPTION selected><font color="Black">Choose </font>
<CFOUTPUT QUERY="GetTips">
<OPTION
value=#CategoryID#>#CategoryName#</OPTION>
</cfoutput>
</SELECT>
</font></P>
<p><font color="Black" face="Arial, Helvetica, sans-serif" size="2">Number
of records to display per page:</font> <font face="Arial, Helvetica, sans-serif" size="2">
<SELECT name=records_to_display>
<OPTION
selected>5
<OPTION>10
<OPTION>20
<OPTION>30
<OPTION>40</OPTION>
</SELECT>
</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="2"><BR>
<INPUT type=submit value=Search>
<BR>
</font> </p>
<P><font face="Arial, Helvetica, sans-serif" size="2"><A href="../../content/TechTips/TECHTIPS.htm">Show
all Tech Tips</A> </font>
</FORM>
</blockquote>
</td>
</tr>
<tr>
<td width="22%"> </td>
<td width="78%">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="84" colspan="4" bgcolor="#ffffff">
<DIV align=left><IMG alt="" border=0 height=69 src="../../images/4_web.jpg" width=338><br></DIV>
</td>
</tr>
<tr>
<td height="21" colspan="4">
<p> </p></td></tr>
</table><cfinclude template="_footer.cfm">
<div align="center"><br>
</div>
</BODY>
</html>
Results Page:
<HTML>
<HEAD>
<TITLE>Results Page</TITLE>
<!-- This Query retrieves the tech tips from the database -->
<CFQUERY DATASOURCE="2029_acc_85005_procedures" NAME="RetreiveInfo">
SELECT A.*, B.CategoryName
FROM tbltips A, tblcategory B
WHERE A.CategoryID=B.CategoryID AND B.CategoryID='#Keyword#'
</CFQUERY>
<!-- If the user access this page for the first time, we set the_start value at 1 -->
<CFPARAM NAME="the_start" DEFAULT="1">
<!-- If the the_start is already defined, then we had 5 to it to calculate the value of next_start -->
<CFIF ISDEFINED("the_start"

<CFSET NEXT_START = #THE_START# + #RECORDS_TO_DISPLAY#>
</CFIF>
</HEAD>
<BODY>
<CFOUTPUT>
There are <b>"#RetreiveInfo.RecordCount#" </b>records in the Database.<BR><BR>
</CFOUTPUT>
<TABLE CELLPADDING="2" CELLSPACING="2">
<TH>Row</TH><TH>Category Name</TH><TH>Question</TH><TH>Provided By</TH>
<CFOUTPUT QUERY="RetreiveInfo" STARTROW="#the_start#" MAXROWS="#records_to_display#">
<TR>
<TD ALIGN="center">#CurrentRow#</TD>
<TD>#CategoryName#</TD>
<td><A HREF="#Article#">#Question#</A></td>
<TD>#ProvidedBy#</TD>
</TR>
</CFOUTPUT>
</TABLE>
<CFOUTPUT>
<!-- the previous button will not be displayed if there's no more record left to display before this page -->
<CFIF #THE_START# IS NOT 1>
<A HREF="results.cfm?the_start=#Evaluate(the_start - records_to_display)#&records_to_display=#records_to_display#&Keyword=#Keyword#">Previous #records_to_display#</A>
</CFIF>
<!-- the next button will not be displayed if there's no more record left to display after this page -->
<CFIF #NEXT_START# LTE RETREIVEInfo.RECORDCOUNT>
<!-- If the next page is the last one, we check how many records are left and display the right count inside the link -->
<CFIF #EVALUATE(NEXT_START + #RECORDS_TO_DISPLAY# - 1)# GT RETREIVEInfo.RECORDCOUNT>
<CFSET NEXT_RECORDS_COUNT = #RETREIVEInfo.RECORDCOUNT# MOD #RECORDS_TO_DISPLAY#>
<A HREF="results.cfm?the_start=#next_start#&records_to_display=#records_to_display#&Keyword=#Keyword#">Next #next_records_count#</A>
<CFELSE>
<A HREF="results.cfm?the_start=#next_start#&records_to_display=#records_to_display#&Keyword=#Keyword#">Next #records_to_display#</A>
</CFIF>
</CFIF>
</CFOUTPUT>
</BODY>
</HTML>
I'm not sure how to incorporate a simple keyword search... Any assitance is appreciated. Thanks,
Lisa