maettig.com

TM::Apeform
A very abstract Web Form Builder and Processor for PHP 4 and 5

TM::Apeform creates self repeating web forms, so called “Affenformulare” (German for “ape forms”). If a million apes is typing into the form (that's the “Infinite monkey theorem”), the form is displayed again and again as long as it contains errors.

  • An Apeform form is created, validated and processed in a single PHP script.
  • The class hides the access to POST and global variables and simply returns the submitted values.
  • It offers an easy way to handle input errors (checking valid email addresses for example).
  • It supports all the form elements including radio buttons, select boxes, file upload fields and so on.
  • It provides an own templating system, so you don't have to deal with HTML at all.
  • It creates labels and access keys according to HTML 4 standard and returns XHTML compatible output.
  • In addition you can add JavaScript handlers to any form element.

The TM::Apeform class is optimized to be used with the minimum amount of source code. For example, the following PHP script is a full functional form mailer.

<?php

require_once("Apeform.class.php");

$form = new Apeform();
$message = $form->textarea("Your Message");
$form->submit("Send Email");
$form->display();

if ($form->isValid())
{
    mail("to@example.com", "Subject", $message);
}

Licensing

The class is open source (of course) and free for non-commercial use. If you want to use it in a commercial project, please ask for a personal license.

Download

New features since 2004

  • Erzeugung mehrerer Textfelder nebeneinander in der selben Formularzeile.
  • Eingebauter Schutz vor Spam-Angriffen durch “Form-Post-Hijacking”.
  • Wahlweise vollautomatische Erzeugung von Accesskeys.
  • Mehr Kontrolle über die Handhabung der intern genutzten HTML-Templates, zum Beispiel kann jeder Formularzeile eine eigene CSS-Klasse zugewiesen werden.
  • Viele kleine Verbesserungen, unter anderem in der Handhabung von Datei-Uploads.