Page 1 of 1

Whether to use Session or table

Posted: Tue Nov 13, 2007 10:03 pm
by Mou
I am facing a problem related to a registration page which involves multiple steps. In every step there is a form and there are two buttons one to proceed to next step and another one to go back to previous step. So, if I click on the button proceed to next step then next form appears but if I click on the back button then I go back to the previous step where all the data which I filled should show.

Now my question is how to implement this with PHP? Whether to use Session variables to store the data and show them whenever needed or to use a table where all the data will be stored?

Thanks,
Mou

Posted: Tue Nov 13, 2007 10:06 pm
by feyd
Sessions.

Posted: Tue Nov 13, 2007 11:13 pm
by Christopher
Yes. The session is for data that needs to persist only for the time of the session -- like your multi-page form data. Databases are for that data that needs to persist beyond the time of a session -- user account data for example.

Posted: Wed Nov 14, 2007 12:13 am
by Kieran Huggins
You can have both ways by using DB session storage!

On second thought, you should probably ignore this post entirely.

Posted: Wed Nov 14, 2007 6:04 am
by jmut
it depends on what you need. Clearly you can achieve this with using sessions or db.
If making orderingprocess or something I would recommend storing all in DB. This way you might collect valuable information to analyze...like on witch step people ditched ordering, if they passed contact and didn't finish, could contact them...etc etc.
Depends what you're doing and if you need to collect all data available.
If still go with sessions...don't forget to validate all data from each step passed! no just the current step.