472,805 Members | 911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

passing search form information

Hi Peoples
i have a search page with a form field "subject" on my results page i have a paging routine . the first page lists its 10 records no trouble but when i click the "next" link i get a error telling me "subject is not defined in form"
How can i overcome this please.
I will post the page down to the end of the paging routine coz its not very long anyway.

[HTML]<cfquery name="searchResults" datasource="#dsn#">
SELECT threadID, posttype, topic, topicID, postdate, username, threads.catID, posttext, categories.catID, category
FROM threads INNER JOIN categories
ON threads.catID=categories.catID
WHERE topic LIKE '#form.subject# %' OR topic LIKE '% #form.subject#' OR topic LIKE '% #form.subject# %' OR topic LIKE '#form.subject#'
OR username LIKE '#form.subject#'
OR posttext LIKE '#form.subject# %' OR posttext LIKE '% #form.subject#' OR posttext LIKE '% #form.subject# %' OR posttext LIKE '#form.subject#'

<!---Set the number of entries (records) per page--->
<cfset perPage = 10>
<!--- Set the parameter "url.start" default to 1--->
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt searchresults.recordCount or round(url.start)
neq url.start>
<cfset url.start = 1>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
<link href="CSStyle/forum.css" rel="stylesheet" type="text/css">


<div id="Layer2" style="position:absolute; left:0; top:0; width:30px; height:23px; z-index:6">
<cfinclude template="header.cfm">
<div id="Layer3" style="position:absolute; left:75px; top:190; width:850; height:83px; z-index:7">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td colspan="2"><span class="standard33">Your search for</span> <span class="standardred">'#form.subject#'</span> <span class="standard33">returned </span><span class="standardred">'#searchResults.RecordCount#'</span> <span class="standard33">results.</span></td>
<tr class="standard">
<td colspan="3" align="right">
<cfif url.start gt 1>
<cfset link = cgi.script_name & "?start=" & (url.start - perpage) & "&subject=" & "#subject#">
<span class="small11-33"><a href="#link#">&lt;&lt; Previous</a></span>
<img src="siteImages/navSeperator.gif" width="5" height="5">
<cfif (url.start + perpage - 1) lt searchresults.recordCount>
<cfset link = cgi.script_name & "?start=" & (url.start + perpage) & "&subject=" & "#subject#">
<span class="small11-33"><a href="#link#">Next &gt;&gt; </a></span>

Cheers and thanks in advance
Mar 13 '07 #1
1 3415
16,027 Expert Mod 8TB
The problem is that 'form' is for POST variables and you are trying to access form.subject without having posted the variable. The solution is to use url.subject and pass the form.subject value in the link, e.g
Expand|Select|Wrap|Line Numbers
  1. nextpage.cfm?subject=#form.subject#
Be sure to use cfparam to set a default in case someone comes along and alters the url. Normally, for searches, I just use the URL so that it's easy to support navigational previous/next links.
Mar 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Matthew Robinson | last post by:
i read a tutorial the other day on passing variables between php pages using a html form and setting the action to the php page to parse, can anybody see anything wrong with the code below? the...
by: Steve Wark | last post by:
I'm trying to develop a lookup form in asp.net (vb), when a button is clicked a small search form will open in a second window which will display a list of values. When a value is selected the...
by: Sami | last post by:
Maybe I am going about this totally wrong.... What I have written is a query pulling SSN, Student-ID, LastName, FirstName, MiddleInitital from a table. Sort is so LastName, FirstName,...
by: tim.pascoe | last post by:
I have a small search form that I generated for an application. It works fairly well buy simply setting the recordset clone of the form that called it, to the ID searched for in the search form. ...
by: sd2004 | last post by:
I am still learning, could someone show/explain to me how to fix the error. I can see it is being wrong but do not know how to fix. could you also recommend a book that I can ref. to ?...
by: TheSailor | last post by:
Forgive me - I am a bit new to cURL and passing form elements from one site to the next... If you can help with a HOW TO or by holding my hand a bit with examples - so I can learn - I would be in...
by: assgar | last post by:
Hi I am stuck on a problem. I use 3 scripts(form, function and process). Development on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. The form displays...
by: imrosie | last post by:
Hello All, (newbie)...I'm working on an Ordering app using the typical tables (customers, orders). I have a Search form to find existing customers prior to entering a new order. On the search form...
by: desertavataraz | last post by:
This is Visual Basic 2008: I have an application where I have the main textbox on the main form, and the search window on a seperate form, and whenever someone clicks the mouse in the main forms...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.