I want to get in ColdFusion 10 an URL parameter from CGI.QUERY_STRING
by its name. How to do it without looping?
Any values passed in to a page via the query string are available in the URL scope.
Assume you have a query string that looks like http://mydomain.com?val1=42&val2=moo
you would access the variables by referencing them as such
<cfset myVal1 = url.val1 />
<cfset myVal2 = url.val2 />
Or, in cfscript
myVal1 = url.val1;
myVal2 = url.val2;
To see all the values passed in via query string, you can also dump out the URL scope.
<cfdump var="#url#" />
or, in cfscript
writeDump( url );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With