Brilliant!

Thanks, that's exactly what I needed.

<cfset cookieVal = COOKIE["appname_#pagename#"]>

I was unaware of this syntax. (Does my newbie status show?)

Thanks heaps.


On May 23, 2:06 pm, "Kevin Pepperman" <[EMAIL PROTECTED]> wrote:
> The variable you are using
>
> <cfset cname="appname_" & "pagename">
>
> when looking a the cookie dump:
> <cfdump var="#COOKIE#">
>
> is producing a cookie named "appname_pagename"
>
> If thats what you intended then you could read the cookie like this
>
> <cfset cookieVal = COOKIE.appname_pagename>
> or
> <cfset cookieVal = COOKIE["appname_pagename"]>
>
> But I am going to assume you intended to use dynamic variables here.
>
> <cfset cname="appname_" & pagename>
> <cfcookie expires="never" name="#cname#" value="TEST">
>
> you can get the cookie value like this if the pagename is dynamic.
>
> <cfset cookieVal = COOKIE["appname_#pagename#"]>
>
> or like this if both are dynamic
>
> eg:
> <cfset cname = appname & "_" & pagename>
> <cfcookie expires="never" name="#cname#" value="TEST">
>
> <cfset cookieVal = COOKIE["#appname#_#pagename#"]>
>
> I hope that helps.
>
> On Thu, May 22, 2008 at 11:40 PM, nedlud <[EMAIL PROTECTED]> wrote:
>
> > I have an app that gets included on three seperate pages withing the
> > same domain (pages A, B, C all use app X). On each page where it gets
> > used, I use a cookie to store user preferences. The preferences need
> > to be unique to where the app gets used, so I dynamicly create the
> > cookie name depending on which page it gets loaded from (page As
> > cookie is called cookie A, page Bs cookie is called cookie B, etc)
>
> > The following code seems to work for naming and setting the cookies...
>
> > <cfset cname="appname_" & "pagename">
> > <cfcookie expires="never" name="#cname#" value="#fvalue#">
>
> > My trouble starts when I'm trying to read the value of the cookie on
> > the next visit.
>
> > <cfset cookieVal = #COOKIE.cname#>
>
> > This isn't working since it's loking for a cookie with the liiteral
> > name of "cname" instead of the value of "cname".
>
> > How do I resolve this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to