Jul 20, 2008

Passing Variables Through A Page?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > ColdFusion Programming

free web hosting

Passing Variables Through A Page?

kvarnerexpress
I have a form that people fill out. Depending on what they fill out on that form, they get different things on the page they're taken to after hitting "submit". Information from both pages goes into a database.

However, I don't want to create a new row until the second page has been filled out and submitted (taking the user to a third page). Is there any easy way to pass all the variables from the first page through the second and to the third? I know I can stick it all in hidden inputs, but I have more than 60 form items to process, and I'd like to not have to code an entire page just to pass them as possible.

Reply

Paul Thomas
QUOTE(kvarnerexpress @ Feb 7 2006, 02:22 PM) *

I have a form that people fill out. Depending on what they fill out on that form, they get different things on the page they're taken to after hitting "submit". Information from both pages goes into a database.

However, I don't want to create a new row until the second page has been filled out and submitted (taking the user to a third page). Is there any easy way to pass all the variables from the first page through the second and to the third? I know I can stick it all in hidden inputs, but I have more than 60 form items to process, and I'd like to not have to code an entire page just to pass them as possible.


Well if you have 60 items to collect, you are going to have to track 60 items page to page unless you do some interim database solution in between. One idea that might make it easier would be to name you Form UI objects according to some pattern: txtBox1, txtBox2, txtBox3 and then write a cfloop to go over them...then instead of writing 60 hidden inputs to maintain you would have something more manageable.

I suppose you could also do session variables but that might put more wear-n-tear on your server then you want.

Thougts?

 

 

 


Reply

sharpz
QUOTE(Paul Thomas @ Feb 16 2006, 08:13 PM) *

Well if you have 60 items to collect, you are going to have to track 60 items page to page unless you do some interim database solution in between. One idea that might make it easier would be to name you Form UI objects according to some pattern: txtBox1, txtBox2, txtBox3 and then write a cfloop to go over them...then instead of writing 60 hidden inputs to maintain you would have something more manageable.

I suppose you could also do session variables but that might put more wear-n-tear on your server then you want.

Thougts?


Isnt there the equivalent of a cookie in CF? If there is there should be no reason to track all 60 items within each page. Im sure theres a way you can create session variables.

Reply

jlhaslip
One possible solution might be to place the items from the first page in to an array and then write the array to a temp database, passing only a row id number before handling the second page, storing the second page info into a second array, then read the first array back and concatenating the two arrays before writing to the db? A bit of a struggle, but if you can code it like suggested above so that the data handling can be looped by an index, it probably wouldn't be so bad.

Reply

Paul Thomas
QUOTE(sharpz @ Feb 16 2006, 11:21 PM) *

Isnt there the equivalent of a cookie in CF? If there is there should be no reason to track all 60 items within each page. Im sure theres a way you can create session variables.


ColdFusion does have a <cfcookie> tag but why store all the values as cookies...it would be easier and probably efficient to use the an html input field or cfinput field instead. Cookies would only come in handy if you were trying to ease the users data entry if they were visiting your site / pages on a reoccuring basis.

smile.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : passing variables


    Looking for passing, variables, page

Searching Video's for passing, variables, page
advertisement



Passing Variables Through A Page?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE