Multipage Form using hidden fields, session variables or custom database storage.

I have designed a multipage form using session, but I concern about its performance as I have nearly 100 fields (6 pages) to remember.

I think it is 3 possible ways to make multiple page form.
1. Hidden fields, all form inputs are generated and send along on each page form but show only those for that page.
2. Session variables, store predefined field in session variables. Again all varibles are sent along with page but less than first case as my multipage form is sequential (user can only back/forward/cancel).
3. Custom database storage. Just store each page variables in database and load them page by page. We need garbage collection here. As I have cancel button this provide me to do garbage collection, and I have also update time to check its heartbeat for particular request. I think this is the BEST SOLUTION.

Please give me any suggestion or comment.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Marcus BointonConnect With a Mentor Commented:
You missed the fourth, and most efficient mechanism: Build the whole thing as one big form and use javascript and CSS to split it into multiple pages. A really good example of this is in the mambo admin interface which you can play with here:

Log into the admin area (it's down right now). The tabs for different settings are all divs on one big form - it has maybe 12 pages, all handled as one form, and you will notice that it's extremely responsive - no delay or refresh when switching between pages. Also there's no trouble with trashing incomplete forms as incomplete forms are never submitted.

More examples here:

The PEAR quickform library also has built-in support for server-side multipage forms:
soapsiamAuthor Commented:

Did you ever try PEAR HTML_QuickForm_Controller? What is it based on?
Marcus BointonCommented:
I've not used QuickForm controller - it's based on QuickForm! Because it's pear, it's all just straight PHP. I do find some of the pear stuff a bit obtuse ;^)
All Courses

From novice to tech pro — start learning today.