What is HTML_Form?
This is a simple HTML form generator. It
supports all the HTML form element types
including file uploads, may return or print the form, just
individual form elements or the full form in "table mode"
with a fixed layout.
Range of use
Generally one can use HTML_Form in
HTML based projects of any form. But especially
when using the package in "table mode" one may soon
run into design problems, because the table that is created by
HTML_Form cannot be equipped with
CSS or other ways to control their look. Thus
the main usage area of HTML_Form are sites
where design does not play the most important role but where it
is necessary to get fast results while keeping the code clean at
the same time. (Examples are back office websites or places like
pear.php.net, where
the package is used at a lot of places.)
Simple usage example
Example 41-1. Basic example require_once "HTML/Form.php";
$form = new HTML_Form('receivingscript.php');
$form->addText("name", "What's your name?");
$form->addSubmit("submit", "Go, Go");
$form->display(); |
|
The above example code creates a HTML form
that only contains a single textfield with the name
"name" and with the label
"What's your name" and a submit button labeled
"Go, Go".
Supported tags
The following HTML form tags are supported by
HTML_Form: textfields, password fields,
checkboxes, textareas, submit buttons, reset buttons, select
fields, radio buttons, image fields, hidden fields, file upload
fields. Additionally one can add blank spaces and plain text to
the form.