Forum Moderators: coopster

Message Too Old, No Replies

Bullet-Proofing multiple form-page data

So that everything gets into the database

         

neophyte

12:20 am on Aug 27, 2008 (gmt 0)

10+ Year Member



Hello All -

This post comes on the heels of another post I made regarding a problem I was having with empty DB records (see thread Empty DB Tables - What could cause it? if you're interested).

I have a current project which contains multiple form pages. On occasion, when a user clicks the final submit button on the last form page, nothing but empty records go into the DB. Respondents from my previous post seem to think that my sessions are timing out as some users don't complete the form section in one sitting. This would seem a very reasonable possibility for these empty records.

So... here's the question:

If YOU have to build a form with multiple pages (say 5 to 8 pages of form data) and you HAVE to make sure that all form data makes it into the DB no matter how long the user takes to do it... how would you do this?

One user from the previous thread suggested creating temporary tables for each form page - when the user goes from one page to the next, the data from the previous page would be saved in the appropriate temp table. This way if the session timed out for the previous page(s) the data would still be available. Another user suggested using cookies to accomplish the same task.

And what about increasing the session-time-out from a default 24 minutes? is that a good idea as well for this type of scenario.

I'm REALLY interested in knowing how the professionals deal with this scenario: while I've been doing .php for about 3 years now, this is a problem I've never faced until now.

What would be ideal for me is a list of things I should absolutely do, like:

1. Increase session time out in php.ini to x
2. When user goes to another page DO save their data in temp tables (or cookies)
3. Make sure that blah, blah, blah
4. More stuff
5. More stuff
6. When user reaches the final page of the section, make sure to blah

And so on...

I hope this isn't asking too much but I would also imagine that this kind of "recipe for success when dealing with multiple form submissions" would be of great assistance to others trying to trouble-out a similar scenario.

Huge appreciation to all in advance!

Neophyte

IndiaMaster

5:14 am on Aug 27, 2008 (gmt 0)

10+ Year Member



I have done a similar thing a few months back. What I did was when the data from first page got posted I stored them in the table which generates the ID of the record (with mysql_insert_id()). Then on I passed that ID to every form and update the record with the data of 2nd, 3rd, 4th form with that ID.

Hope it helps you a little bit.