how do I pass a value from a page to another page that is not in a form.

I am refreshing a form based on the selection of a combo box.  There is a value that was passed from a previous page and I want to keep that value to pass it in the refreshed page.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Use url, session variables, cookies, lots of options.

But lets start with url.

<cflocation url="nextPage.cfm?employee=#employee#" />

on nextPage.cfm

you can access it using



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
on the selection of a combo box submit the form and send the value in hidden type


<input type="hidden" name="variablename" value="#value#">

oops sorry i didnt saw your question clearly

you can pass the variables url and another thing is that you can create a dummy form

<form name="" action "">
<input type="hidden" name="variablename" value="#value#">

onclick or onselection you can submit this form
I would either go with Plucka's example and send it via the url querystring or via sessions (which Plucka also mentioned).  Here would be an example of that for referrence.

<cfif IsDefined("FORM.mySubmittedValue")>
    <cflock type="exclusive" scope="session" timeout="10">
    <cfset SESSION.myStoredFormValue = FORM.mySubmittedValue>

Now you can just referrence SESSION.myStoredFormValue anywhere you wanted to look at the form value.  If you only need one field then I'd recommend Plucka's URL placement instead.  However if you have 10 fields or something to do this will I'd just recommend using the SESSION method.  In fact if you want you could store the whole FORM scope in a SESSION variable like so:

<cfif IsDefined("FORM.mySubmittedValue")>
    <cflock type="exclusive" scope="session" timeout="10">
    <cfset SESSION.mySavedFormScope = structNew()>
    <cfset temp = structAppend(SESSION.mySavedFormScope,FORM)>

Now you can referrence the previous form as many times as you like without issue.  The only thing is that you should clean up the session at the end of the process to reduce memory load.  To do that you would simply remove the SESSION key that you added in the first process (probably when you process the form data from the second page if there is one).

Where ever you want your cleanup done:
<cfif IsDefined("SESSION.mySavedFormScope")>
    <cflock type="exclusive" scope="session" timeout="10">
    <cfset temp = structDelete(SESSION,"mySavedFormScope")>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.