Hi,
I would recommend against Abinidi's post. Do not use session
variables!
That always causes problems if somebody goes directly to that
page and the session variables don't contain the same values, as
example for search engines or if somebody adds the URL to their
favorites.
If you should use GET or depends on the situation:
1) As example with customer-facing product listings, where
people should be able to link directly to that page, or add the URL
to their favorites, or search engines should be able to display the
filtered page in their search results, => Use GET
2) If the page is as example an internal administration page,
and people should always be set to the empty default search screen
=> Use POST
cheers,
fober
For my applications I have built a function that I always use
to update URL parameters, independent of any other parameters in
the URL Query-String:
<!--- ==== USAGE SAMPLE
===================================== --->
<cfoutput>
<cfloop index="x" from="1" to="85" step="10">
<a
href="#CGI.SCRIPT_NAME#?#URL_Update(CGI.QUERY_STRING,'startrow',x)#">Row:#x#-#x+9#</a>
|
</cfloop>
</cfoutput>
<!--- ==== FUNCTION
========================================= --->
<cffunction name="URL_Update" returntype="string"
output="No">
<cfargument name="url_attributes" required="Yes"
type="string">
<cfargument name="item" required="Yes" type="string">
<cfargument name="value" required="Yes" type="string">
<cfif url_attributes is "">
<cfif value neq "">
<cfreturn "#item#=#value#">
<cfelse>
<cfreturn "">
</cfif>
</cfif>
<cfloop index= "temp" from= "1" to=
"#listlen(url_attributes,'&')#">
<cfif find(ucase(item), ucase(listgetat(url_attributes,
temp, '&'))) gt 0>
<cfif value neq "">
<cfreturn "#listsetat(url_attributes, temp,
'#item#=#value#', '&')#">
<cfelse>
<cfreturn "#listdeleteat(url_attributes, temp,
'&')#">
</cfif>
</cfif>
</cfloop>
<cfif value neq "">
<cfreturn
"#listappend(url_attributes,'#item#=#value#','&')#">
<cfelse>
<cfreturn "#attributes#">
</cfif>
</cffunction>