You can also do this.

<cfloop list="#cgi.query_string#" index="ii" DELIMITERS="&">
<cfset name = Replace(ListFirst(ii, "="), "-", "_", "ALL")>
<cfset '#name#' = ListLast(ii, "=")>
<cfoutput>#name#=#evaluate(name)#<br></cfoutput>
</cfloop>

> -----Original Message-----
> From: CM Randall [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 10, 2000 5:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: URL parameter and the "-" character
> 
> 
> Max,
> 
> You are correct.  The problem is that you can not use "-" as 
> a variable 
> name.  BTW, I'm getting these variables sent to me by a 
> credit card company 
> and they don't want to change the values.
> 
> This is what I have so far:
> 
> <cfset temp = CGI.QUERY_STRING>
> <cfset temp =  Replace(temp, "card-", "card_", "All")>
> 
> <cfoutput>#temp#</cfoutput>
> 
> I get this string: 
> mode=new&orderID=909987767&item1=2&user_id=116&card_address1=a
> dd1&card_address2=add2&card_city=city&card_state=state&card_zi
> p=93950&country=usa&phone=831-643-2989&fax=831-643-2989
> 
> Now, how do I extract card_address2=add2, card_city=city
> card_state=state and card_zip from this string?  If I can do 
> that then all I 
> have to do is set the values with an underscore and pass that value.
> 
> If someone can help me with this it would be a great help.
> 
> Thanks,
> CM
> 
> 
> 
> 
> >From: Max Paperno <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: URL parameter and the "-" character
> >Date: Sun, 10 Sep 2000 12:37:59 -0400
> >
> >
> >Hi,
> >
> >The problem is that the hyphen ('-') isn't allowed in a 
> variable name.  
> >This is a CF spec/limitation.  That would include URL and 
> form variable 
> >names.  Try an underscore.
> >
> >Or, if you can't control the name of the URL variable (for 
> some reason), 
> >you'll need to do some CGI.QUERY_STRING parsing and  replace 
> any hyphens 
> >with underscores in the variable name, before you try to use 
> the variable 
> >in your CFML.
> >
> >HTH,
> >-Max
> >
> >
> >At 9/10/2000 11:52 AM -0400, CM Randall wrote:
> > >I'm having a problem reading a URL parameter when it has a 
> minus sign "-" 
> >in
> > >the URL var name.
> > >
> > >For example, someone is passing to me via URL 
> card-address=MyAddress.
> > >
> > >I can not read this by doing the following:
> > ><cfoutput>#url.card-address1#</cfoutput>
> > >OR
> > ><cfset addr1 = url.card-address1>
> > >
> > >When I get an error is tells me that the parameter card 
> doesn't exist.
> > >
> > >How do I escape the - character so it doesn't error out?  
> I know this can
> > >work because it is displaying in the CF debug area at the 
> bottom of the
> > >page.
> > >
> > >Thanks!
> > >
> > >CM
> >
> >-------------------------------------------------------------
> -----------------
> >To Unsubscribe visit 
> >http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lis
ts/fusebox or 
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in 
>the body.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

----------------------------------------------------------------------------
--
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to