PHP Classes

File: example_multipage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Thiemo Mättig  >  TM::Apeform  >  example_multipage.php  >  Download  
File: example_multipage.php
Role: Example script
Content type: text/plain
Description: How to split a form into multiple pages
Class: TM::Apeform
A very abstract web form builder and processor
Author: By
Last change: Updated
Date: 6 years ago
Size: 1,378 bytes


Class file image Download

 * Multiple page form example. Shows use of a big multiple page form to
 * acquire a large ammount of data.
 * @author Thiemo Mättig (


// Create the first form.
$form = new Apeform();
// Add the first three form elements.
$element0 = $form->text("First form, element 0");
$element1 = $form->text("First form, element 1");
$form->submit("Go to second form");

if (!
// Display the first form.
// Create the second form.
$form = new Apeform();
// Create hidden elements for any element that comes from the first form.
    // Although they look like dummy elements, they are required components.
$form->hidden(); // element0
$form->hidden(); // element1
$form->hidden(); // element2
    // Reset the submission state of the form (private object property).
$form->_isSubmitted = false;
// Add some more form elements.
$element3 = $form->text("Second form, element 3");
$form->submit("Submit both forms");

    if (!
// Display the second form.
// Process the collected form data.
echo "INSERT INTO `table` SET `element0` = '$element0'";
", `element1` = '$element1', `element3` = '$element3'";