Very often it is necessary to split up one long form into several smaller forms, placed across several pages. When this is the case, there are three possible tactics you can take:
Use hidden form elements
Store answers in session values
Store answers in a database
Of the three, you are most likely to find option #1 the easiest to program and the easiest to debug. As long as you are using HTTP POST, data size will not be a problem, and the advantage to use hidden form elements is that you can view the HTML source code at any time to see if things are working as planned.
If our existing form was part one of a larger set of forms, we would need to append the following HTML to the bottom of part two of the forms so that the values are carried over to part three:
<input type="hidden" name="Name" value="<?php print $_GET['Name']; ?>"> <input type="hidden" name="Password" value="<?php print $_GET['Password']; ?>">
You'd need to have all the others there also, but it works in the same way so there is no point repeating them all here.
Next chapter: Files sent through forms >>
Previous chapter: Handling our form
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.