Creating Multi-Step Forms And Wizards In PHP
There will be many situations when creating web forms, that either you cannot accept all data on one page, either because certain responses result in a different set of subsequent questions, or because you form is so long that you need to split it up into multiple pages. The case could even be that you have a 1 page form, but you want to show confirmation of the form data prior to processing the data (e.g. showing a user their order before processing their credit card).
This tutorial covers how to implement such forms using PHP. This will include covering the various issues that need to be taken into consideration, as well as a class to help build such forms. Finally, there will be real-world example of implementing a multi-page form using the class.
One thing you should be aware of though, is that there is a lot of work on properly developing multi-step forms. Even with a package like PEAR’s HTML QuickForm Controller, it still takes time in setting everything up. We won’t be looking at that package in this tutorial, as there are many aspects I personally don’t like about the class (which is why I developed my own lightweight Wizard class).