Having a problem setting my site to show next search results.
Hey everyone. I am having a problem with setting up a next and previous link to show the results from a search engine i made. Also when the next link does show up and i hit it with the results on the page, it resets the whole page. Any idea what i am doing wrong?
===============================================================================================================
<cfparam name="FORM.Islands" default="" />
<cfparam name="URL.StartRow" default="1">
<cfset sNextRow = URL.StartRow + 2 />
<cfset sPreviousRow = URL.StartRow - 2 />
<cfquery name="qResults" datasource="wyi2">
SELECT BusinessID, BusinessName, Address, IslandID, Phone, WebID
FROM Business
WHERE IslandID = <cfqueryparam value="#FORM.Islands#">
ORDER BY BusinessName ASC
</cfquery>
<cfquery name="qIslands" datasource="wyi2">
SELECT IslandID, IslandName
FROM Islands
ORDER BY IslandName ASC
</cfquery>
<!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=utf-8" />
<title>.: Where Ya Is :.</title>
<link href="../css/wyi.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--- Start Div container --->
<div id="Container">
<!--- Start div banner --->
<div id="sBanner">
<img src="../images/logo_Store_Sales.jpg" width="400" height="175" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="220,153,268,169" href="../index.cfm" target="_self" alt="Home" />
<area shape="rect" coords="287,152,373,168" href="../contact/index.cfm" target="_self" alt="Contact Us" />
</map>
</div>
<!--- End div banner --->
<!--- Start Search form --->
<div id="sForm">
<cfform action="#CGI.SCRIPT_NAME#" method="post" preservedata="yes">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>
<cfselect name="Islands"
query="qIslands"
display="IslandName"
value="IslandID"
queryPosition="below">
<option value="all">Please select an island</option>
</cfselect>
</td>
<td>
<cfinput type="submit" name="Find_btn" class="button" value="Find store" />
</td>
</tr>
</table>
</cfform>
</div>
<!--- End Search form --->
<!--- Start Results section --->
<div id="sResults">
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td colspan="3">
<cfif IsNumeric(FORM.Islands)>
<cfoutput>
We have found #qResults.RecordCount# store<cfif (qResults.RecordCount GT 1) OR (qResults.RecordCount LT 1)>s</cfif>.
</cfoutput>
<cfelse>
Please select an island to help us find the store you are looking for.
</cfif>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<cfif qResults.RecordCount GT 2>
<cfoutput>
<tr>
<td width="150">
<cfif URL.StartRow GT 2>
<a href="#CGI.SCRIPT_NAME#?StartRow=#sPreviousRow#">Previous</a>
</cfif>
</td>
<td width="150">
<a href="#CGI.SCRIPT_NAME#?StartRow=#sNextRow#">Next</a>
</td>
<td>
</td>
</tr>
</cfoutput>
</cfif>
<cfoutput query="qResults" startrow="#URL.Startrow#" maxrows="2">
<tr>
<td colspan="3">
<p><a href="results.cfm?BusinessID=#BusinessID#">#BusinessName#</a></p>
</td>
</tr>
</cfoutput>
<tr>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td colspan="3">Copyright 2010,© Where ya is, All Rights Reserved</td>
</tr>
</table>
</div>
<!--- End Results section --->
<!--- Start Advertising --->
<div id="Advert">
<img src="../images/ad_sample.jpg" width="200" height="200" />
</div>
<!--- End Advertising --->
</div>
<!--- End Div container --->
</body>
</html>
=============================================================================================================