Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop on url parameters

Status
Not open for further replies.

evergreean43

Technical User
May 25, 2006
165
US
I have a URL that comes up in a search results page where it shows next record. It works great but I need more efficient way to test conditions. I have 10 search fields that could be entered and I check if each one is defined in the url. Here is an example just showing 2 out of my 10 conditions on the url:
Code:
<a href="results.cfm?myStartRow=#mystartRowVar#<cfif isDefined('city')>&city=#city#</cfif>#<cfif isDefined('state')>&state=#state#</cfif>">Next</a>

I am trying to put it in a loop but cant get it working. I get errors on the loop with the index value and the url argument not valid. Please advise.
Code:
<cfset mylist = "">
<cfoutput>
    <cfloop list="#fieldnames#" index="i">
      <cfif isDefined('#i#')>
        <cfset mylist = listAppend(mylist, i &"="& #i#, "&")>
      </cfif>
    </cfloop>
<cfoutput>

...

<a href="results.cfm?myStartRow=#mystartRowVar##mylist#">Next</a>
 
#1) You need to scope your variables. Are they coming from a form? Are they already in the Url? Are you manually setting them somewhere else on the page?

Without variable scopes we can only guess at what your trying to do, and without variable scopes ColdFusion can only guess at what your trying to do.

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
The initial entry is coming from form and then the action page puts the variables in a url to be passed to "Next" page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top