Pros and Cons of Form Filling

PC Pro logo Posted: 1st July 2001 | Filed under: Press Articles, Technical
Author: Paul Ockenden
First Appeared in PC Pro 2001

A frequent query in the various scripting newsgroups concerns how to handle forms that are split over multiple pages. Imagine a hundred-question form split over ten pages, which results in the production and emailing of a CSV file. What's the best way to handle this? You have three basic choices, the first being to use hidden form fields to pass the data from page to page. An obvious pro of this method is that it's very easy, but the cons are that it will slow down the site as data is continuously passed between server and browser and vice versa, and there's a bigger chance of mistakes. It will also make the system more difficult to maintain.

The second choice is to use session variables, which are supported by the majority of server-side scripting technologies. The main pro for this method is that, again, it's very easy to set up. The con is that if someone goes for lunch halfway through filling in their form, the session will time out and all of their data will be lost (and the chances of someone taking a break during a hundred-question form are high).

The third, and by far the best method, is to save each screenful in some kind of temporary store, probably a database of some description, and to use an id tag (via either GET or POST) to maintain a link to the correct temporary store. You'd clean the store out at the end of the process and have a regular housekeeping task that sweeps up data from any abandoned sessions. The pro here is that this is the most robust solution; the con is that it might take an extra half-hour to get working.