Usage examples

Usage examples

Usage examples -- Using HTML_Form.

Creating the form in "table mode"

Creating a form in "table mode" means that the package returns the complete form in a fixed width table. Whilst this does not work very well for most frontend websites, it is a very convenient way to create forms during development phase or for backend systems where the design does not matter (much).

This will display a table where the left column holds the labels of the different fields. In the right column the different fields are placed.

Displaying single form tags

Apart from retrieving the table as a whole, one can also use the API of HTML_Form to directly display single form tags.

The above example will print the HTML markup being necessary to render a text input field. It will not print the surrounding <form /> tag or something else!

Returing single form tags

Similar to displaying form tags with the display*() functions HTML_Form can also return the tag instead of printing it.

The variable $str now contains HTML markup like <input type="password" name="password" />.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.