Приглашаем посетить
Набоков (nabokov-lit.ru)

Section 9.4.  Splitting Forms Across Pages

Previous
Table of Contents
Next

9.4. Splitting Forms Across Pages

Very often it is necessary to split up one long form into several smaller forms, placed across several pages. When this is the case, you can pass data from page to page by using hidden form elements, storing answers in session values, or storing answers in a database.

Of the three, you are most likely to find using hidden form elements the easiest to program and the easiest to debug. As long as you are using POST, data size will not be a problem, and the advantage is that you can view the HTML source code at any time to see if things are working as planned. Of course, that also means that hackers can view the source code (and make changes to it), so you should really only resort to hidden fields if you can't use sessions for some reason.

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.


Previous
Table of Contents
Next