PHP Classes

File: example_multiform.php

Recommend this page to a friend!
  Classes of Thiemo Kreuz   TM::Apeform   example_multiform.php   Download  
File: example_multiform.php
Role: Example script
Content type: text/plain
Description: How to use multiple forms on a single page
Class: TM::Apeform
A very abstract web form builder and processor
Author: By
Last change: Accessible without user login
Date: 14 years ago
Size: 867 bytes


Class file image Download

 * Single page, multi form example. Shows one possible solution how to use
 * multiple forms on a single page.
 * @author Thiemo Mättig (


// Define form A. This gots no id (defaults to "form").
$formA = new Apeform();
$textA = $formA->text();
$submitA = $formA->submit("Button A");

// Define form B. Important: This gots a different id.
$formB = new Apeform(0, 0, "formB");
$textB = $formB->text();
$submitB = $formB->submit("Button B");

// Display form A.

// Display form B. The auto-focus is disabled here cause the form gots an id.

// Process form A.
if ($formA->isValid())
"Form A submitted: " . $textA;

// Process form B.
if ($formB->isValid())
"Form B submitted: " . $textB;