Copy link to clipboard
Copied
I have to pass a value using a session, I want to create a session based on the UID of the item in question, and there will be several of them, so I might have UID:23, UID:40, UID: 200 for example. Then on the following page I can relate that value back using UID.
The question is, what is the correct format for this? Could anybody post an example of
a) How I set the session name, let's say that the UID is stored in a query variable #GETCAMP.CAMP_UID#
b) How would I then read it back (The value of getcamp.camp_uid) is also passed through
I know this is not right but I think I might be close with -->
SET:
<CFSET session.[getcamp.camp_uid] = "#getcamp.camp_uid#">
READ:
<CFOUTPUT>#session.[url.camp_uid]</CFOUTPUT>
Thanks
Mark
Thanks for the links, after reading them and going back to what I originally had, I found the problem. I had a period after the #session which I should omit
<CFSET Session.10="a">
<CFSET TestField="10">
<CFOUTPUT>#session[testfield]#</CFOUTPUT>
Thanks
Mark
Copy link to clipboard
Copied
You could put an empty structure into your session scope and add keys to it as required. Be careful about what you put into the session scope though. With all browser tabs and new browser windows sharing the same session, it's possible for values to be mistakenly overwritten.
Copy link to clipboard
Copied
I am not concerned about the multiple windows as it's going to be used inside a mobile phone app that draws content from the server, and the app would just not allow more than one session to ever exist, so I'm safe in that department.
Could you possibly give me a small example of what you were describing?
Thanks
Copy link to clipboard
Copied
Could you possibly give me a small example of what you were describing?
There's a whole section in the docs about how to use variables in CF. You should really make sure you know this stuff thoroughly if you're using CF (as it's about as fundamental as it gets when using a programming language):
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7ff2.html
Specifically:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec09af4-7fee.html
struct[dynamicKeyName] = value
Where "struct" is the struct one is using (and a scope - for all intents and purposes - is a struct), "dynamicKeyName" is a string or a variable containing a string which is the name fo the key, and "value" is... err... the value.
But don't take my word for it: read the docs and get up to speed with all this stuff.
--
Adam
Copy link to clipboard
Copied
Thanks for the links, after reading them and going back to what I originally had, I found the problem. I had a period after the #session which I should omit
<CFSET Session.10="a">
<CFSET TestField="10">
<CFOUTPUT>#session[testfield]#</CFOUTPUT>
Thanks
Mark
Copy link to clipboard
Copied
Please kindly mark thread as answered. It will help others.
Copy link to clipboard
Copied
Done
Copy link to clipboard
Copied
Thanks.