How to stop worrying and learn to love the session. :-)

Don't forget to wrap a <cflock> around that code.

Bryan Love wrote:

> Why you would want to convert innocent, safe form fields into tricky,
> unstable session variables is beyond me, but here's the code...
>
> <cfloop list="#form.fieldnames#" index="i">
>         <cfset "session.#i#" = evaluate("form." & i)>
> </cfloop>
>
>
> Bryan Love ACP
> Internet Application Developer
> [EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Jay Wigginton [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 16, 2001 1:35 PM
> To: CF-Talk
> Subject: form to session
>
> Is there a simple way to take the values submitted from a form and setting
> session variables with the same name... example:
>
> form submits variables.... Form.FirstName and Form.LastName... I need to
> set... Session.FirstName = Form.FirstName and Session.LastName =
> Form.LastName...
>
> I know I can use... <cfset Session.FirstName = Form.FirstName>
>
> But, I want to do this <cfloop> looping over the fieldnames... something
> like...
>
> <cfloop index="field" list="#fieldnames#">
>         <cfoutput>
>                 <cfset session.#field# = Form.#field#>
>         </cfoutput>
> </cfloop>
>
> The above produces an error... :(
>
> thanks in advance
> Jay
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to