PHP and Multi-page forms

Permabanned
Joined
25 Oct 2004
Posts
9,078
Hiya folks,

Need to get a multipage form sorted for a site im doing and ive no idea where to start really, Ideally it would have to be totally secure as some of the data being collected is private and confidential.

Ive considered several methods but really not sure where to start, either the hidden input way or sessions.

Anyone have any recommendations and/or tutorials on the methods, form will consist of 4-5 pages of data including lots of check/option box's.

Any assistance is greatly appreciated.
 
If it needs to be secure make sure you set the session storage to be in a private location not accessible by other sites on the host (and of course, .htaccessed to disallow direct access via the web).

The other option, if that's not possible, is either overriding the session handler with a default one that stores stuff in the database. This can either be in fields or, more simply, as a serialized blob.

That's how we've done it before for a fairly complex (12 pages, multiple variants of pages depending on previous output) registration form.

The final option is to pass a serialized blob that you encrypt with a shared key as a hidden field, but this can start making the page load time quite hefty the further you go on, but it has the added benefit of not requiring any storage on your host.
 
Thats a possibility but would rather learn how to do it properly rather than "hack" my way around things.

The actual site design is pretty specific so over all page dimensions wont change much at all. The form I plan on creating is actually 5 A4 pages worth so could actually end up being much bigger than 5 html form pages.
 
hmmmm I did a multi page survey for a client and I just worked out how I wanted to save the data to the db and saved it as each page was submitted and used a session key to keep track of the person who was filling in the survey.

The benefit to this approach is that you can work out if lots of people are abandoning the form, and if so, where. etc.
 
Also, if you are doing multiple pages and using the database approach, do a post to save the data, then a redirect to the next page - otherwise you get the dreaded "do you want to repost the data" popup when people use the back button.
 
Back
Top Bottom