Whenever I am to organize a lengthy form for that client I usually wish to split it into separate pages, therefore the customer does not need to grow it all, but will it in steps.

Something similar to:

Step 1  >  Step 2  > Step 3 > Thank You!

I have never tried it for just one reason: I'm not sure how you can keep data from separate steps effectively? By effectively I am talking about, how you can store it, then when a customer decides to not finish it at Step Three all of the information is erased.

I have develop couple of methods for how this may be resolved, but I am simply not convinced by them:

  1. Storing form data in database
    I know a table with posts representing each question, with final column representing a bool value if the form continues to be completed or otherwise?
    However I would need to perform a clean-up on the table every occasionally (possibly even each time it will get up-to-date with new data?) and remove all records with complete = 0.

  2. Store form data in session data.
    This however, doesn't have to keep data in database (for the way periods are now being handled) and all sorts of info could be in Cookie. But let's say browser does not support snacks or user disabled them (rare, but happens), or maybe form has file accessories, then this can be a no-go.

  3. echo'ing form data from previous page as <input type="hidden"> around the next page
    Yes, I am aware this can be a rather stupid idea, but it is an alternate. Poor, but it's.

Option 1 appears to be the greatest, however i feel it's unnecessary to keep temporary data in DB. And let's say this becomes the most popular form, with many different site visitors filling it in? The quantity of Updates/Removes might be massive?

I wish to understand how you cope with it.


Edit

David requested a great question. What technology I am using?
I take advantage of PHP+MySQL, however i seem like it's more generic question. Please share your solutions regardless of of the items server-side technology you utilize, as I am sure the idea could be modified one of the ways or another to various technologies.

I believe the option between options 1 and a pair of comes lower to just how much data you're storing. I believe generally the quantity of data you're receiving full payment for an application will probably be fairly small (a couple of kilobytes). For the reason that situation, I believe storing it within the session information is what you want. There isn't much overhead in passing that quantity of data backwards and forwards. Also, unless of course your customers take presctiption computer systems where there's a strict security policy in position, the applying should work. If one makes the page needs obvious customers can determine if they would like to proceed or otherwise.

If you're storing considerable amounts of information for that form a database could be better so you don't have to pass the information backwards and forwards. However, I believe this will probably be a reasonably rare situation. Even when the applying enables the uploading of files it can save you individuals to some temporary location and just write these to the database when the form is finished. Another situation where you might like to make use of a database is that if your form must have the ability to offer the user departing and returning at another time to resume the shape.

To be sure that option 1 is the greatest, because it features a couple of benefits within the other 2:

  • When the information is endured, customers can return later and continue the procedure
  • Your code base is going to be considerably cleaner with incremental saves, also it relieves the requirement for 1 massive save operation
  • Your feet print (each page request) is going to be lighter than option 3

If you are concerned about performance, you are able to queue the information to become saved, since you don't need to save it near-real-time.

Edit to obvious up a misunderstanding: The information inside PHP Periods, automatically, aren't saved in Snacks and can handle storing lots of data without an excessive amount of overhead.