PHP Classes
Icontem

File: example_multiform.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Thiemo Mättig  >  TM::Apeform  >  example_multiform.php  
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
 

Contents

Class file image Download
<?php

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

require_once("Apeform.class.php");

// 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(00"formB");
$textB $formB->text();
$submitB $formB->submit("Button B");

// Display form A.
$formA->display();

// Display form B. The auto-focus is disabled here cause the form gots an id.
$formB->display();

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

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

?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products