Session or hidden fields?

Hey guys,

I suppose i have a rather simple question, but i am not able to answer it myself, yet. This is the scenario:

You collect user input within a form. The page/script the form is directed at (the form’s action) should not process the input, but store it for the next script to process. So there is one script and html page between collecting and processing the data. What is the better way to störe the input. Should i write it to the Session or store it in hidden input field on the html page in between or is there a better way i did not even see yet?

Thanks for your replies!


hello, sessions is better

Is it "just" safer or easier or faster? What are the advantages?

creating hidden fields will make ur forms cumbersome while session will not only keep data to the next process but also maintain data for as long as you need it.

Use statefulForm:

This will allow you to post page1 data to page2 data and is handled by Yii itself.

Awesome! That was what i looked for. Thanks!

You could also use local storage. :)


But statefulForm is great!