Source for file Form.php
Documentation is available at Form.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Stig Bakken <ssb@fast.no> |
// | Urs Gehrig <urs@circle.ch> |
// | Daniel Convissor <danielc@php.net> |
// +----------------------------------------------------------------------+
// $Id: Form.php,v 1.8 2004/06/14 03:18:18 danielc Exp $
// HTML form utility functions.
if (!defined('HTML_FORM_TEXT_SIZE')) {
define('HTML_FORM_TEXT_SIZE', 20 );
if (!defined('HTML_FORM_MAX_FILE_SIZE')) {
define('HTML_FORM_MAX_FILE_SIZE', 1048576 ); // 1 MB
if (!defined('HTML_FORM_PASSWD_SIZE')) {
define('HTML_FORM_PASSWD_SIZE', 8 );
if (!defined('HTML_FORM_TEXTAREA_WT')) {
define('HTML_FORM_TEXTAREA_WT', 40 );
if (!defined('HTML_FORM_TEXTAREA_HT')) {
define('HTML_FORM_TEXTAREA_HT', 5 );
* HTML form utility functions
* @author Stig Bakken <ssb@fast.no>
* @author Urs Gehrig <urs@circle.ch>
* @author Daniel Convissor <danielc@php.net>
* @version $Id: Form.php,v 1.8 2004/06/14 03:18:18 danielc Exp $
* ACTION attribute of <form> tag
* METHOD attribute of <form> tag
* NAME attribute of <form> tag
* an array of entries for this form
* DB_storage object, if tied to one
* TARGET attribute of <form> tag
* ENCTYPE attribute of <form> tag
* additional attributes for <form> tag
* @since Property available since Release 1.1.0
* @param string $action the string naming file or URI to which the form
* @param string $method a string indicating the submission method
* @param string $name a string used in the <form>'s 'name' attribute
* @param string $target a string used in the <form>'s 'target' attribute
* @param string $enctype a string indicating the submission's encoding
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
function HTML_Form($action, $method = 'get', $name = '', $target = '',
$enctype = '', $attr = '')
// =========== ADD ===========
* Adds a text input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayText(), HTML_Form::displayTextRow(),
* HTML_Form::returnText(), HTML_Form::returnTextRow()
function addText($name, $title, $default = '',
$size = HTML_FORM_TEXT_SIZE , $maxlength = 0 ,
$attr = '', $thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('text', $name, $title, $default, $size,
$maxlength, $attr, $thattr, $tdattr);
* Adds a password input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
* HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
$size = HTML_FORM_PASSWD_SIZE ,
$maxlength = 0 , $attr = '', $thattr = 'align="right"',
$this->fields[] = array ('password', $name, $title, $default, $size,
$maxlength, $attr, $thattr, $tdattr);
* Adds a checkbox input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
* HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
function addCheckbox($name, $title, $default = false , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('checkbox', $name, $title, $default, $attr,
* Adds a textarea input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $width an integer saying how many characters wide
* @param int $height an integer saying how many rows tall the
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
* HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
$width = HTML_FORM_TEXTAREA_WT ,
$height = HTML_FORM_TEXTAREA_HT , $maxlength = 0 ,
$attr = '', $thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('textarea', $name, $title, $default, $width,
$height, $maxlength, $attr, $thattr, $tdattr);
* Adds a submit button to the list of fields to be processed by display()
* @param string $name a string used in the 'name' attribute
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
* HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
function addSubmit($name = 'submit', $title = 'Submit Changes',
$attr = '', $thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('submit', $name, $title, $attr, $thattr,
* Adds a reset button to the list of fields to be processed by display()
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayReset(), HTML_Form::displayResetRow(),
* HTML_Form::returnReset(), HTML_Form::returnResetRow()
function addReset($title = 'Discard Changes', $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('reset', $title, $attr, $thattr, $tdattr);
* Adds a select list to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param array $entries an array containing the <options> to be listed.
* The array's keys become the option values and
* the array's values become the visible text.
* @param mixed $default a default value for the element
* @param int $size an integer saying how many rows should be
* @param string $blank if this string is present, an <option> will be
* added to the top of the list that will contain
* the given text in the visible portion and an
* empty string as the value
* @param bool $multiple a bool saying if multiple choices are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
* HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
function addSelect($name, $title, $entries, $default = '', $size = 1 ,
$blank = '', $multiple = false , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('select', $name, $title, $entries, $default,
$size, $blank, $multiple, $attr, $thattr,
* Adds a radio input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $value the string used for the item's value
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
* HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
function addRadio($name, $title, $value, $default = false , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('radio', $name, $title, $value, $default,
$attr, $thattr, $tdattr);
* Adds an image input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $src the string denoting the path to the image.
* Can be a relative path or full URI.
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayImage(), HTML_Form::displayImageRow(),
* HTML_Form::returnImage(), HTML_Form::returnImageRow()
function addImage($name, $title, $src, $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('image', $name, $title, $src, $attr, $thattr,
* Adds a hiden input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $value the string used for the item's value
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayHidden(), HTML_Form::returnHidden()
function addHidden($name, $value, $attr = '')
$this->fields[] = array ('hidden', $name, $value, $attr);
* Adds a blank row to the list of fields to be processed by display()
* @param int $i the number of rows to create. Ignored if
* @param string $title a string to be used as the label for the row
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
* HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
function addBlank($i, $title = '', $thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('blank', $i, $title, $thattr, $tdattr);
* Adds a file upload input to the list of fields to be processed by display()
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayFile(), HTML_Form::displayFileRow(),
* HTML_Form::returnFile(), HTML_Form::returnFileRow(),
* HTML_Form::returnMultipleFiles()
function addFile($name, $title, $maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE , $accept = '', $attr = '',
$thattr = 'align="right"', $tdattr = '')
$this->enctype = "multipart/form-data";
$this->fields[] = array ('file', $name, $title, $maxsize, $size,
$accept, $attr, $thattr, $tdattr);
* Adds a row of text to the list of fields to be processed by display()
* @param string $title the string used as the label
* @param string $text a string to be displayed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::display(),
* HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
* HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
$thattr = 'align="right"', $tdattr = '')
$this->fields[] = array ('plaintext', $title, $text, $attr, $thattr,
// =========== DISPLAY ===========
* Prints the opening tags for the form and table
* NOTE: can NOT be called statically.
* @param bool $multipartformdata a bool indicating if the form should
* be submitted in multipart format
* @see HTML_Form::display(), HTML_Form::end(), HTML_Form::returnStart()
function start($multipartformdata = false )
* Prints the ending tags for the table and form
* NOTE: can NOT be called statically.
* @see HTML_Form::display(), HTML_Form::start(), HTML_Form::returnEnd()
* Prints a text input element
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayTextRow(), HTML_Form::addText(),
* HTML_Form::returnText(), HTML_Form::returnTextRow()
function displayText($name, $default = '', $size = HTML_FORM_TEXT_SIZE ,
$maxlength = 0 , $attr = '')
* Prints a text input element inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayText(), HTML_Form::addText(),
* HTML_Form::returnText(), HTML_Form::returnTextRow()
$size = HTML_FORM_TEXT_SIZE , $maxlength = 0 ,
$attr = '', $thattr = 'align="right"', $tdattr = '')
$maxlength, $attr, $thattr, $tdattr);
* Prints a password input
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayPasswordRow(), HTML_Form::addPassword(),
* HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
$size = HTML_FORM_PASSWD_SIZE ,
$maxlength = 0 , $attr = '')
// {{{ displayPasswordRow()
* Prints a password input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayPassword(), HTML_Form::addPassword(),
* HTML_Form::returnPassword(), HTML_Form::returnPasswordRow()
$size = HTML_FORM_PASSWD_SIZE ,
$maxlength = 0 , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$size, $maxlength, $attr, $thattr,
* Prints a checkbox input
* @param string $name the string used in the 'name' attribute
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayCheckboxRow(), HTML_Form::addCheckbox(),
* HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
// {{{ displayCheckboxRow()
* Prints a checkbox input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayCheckboxRow(), HTML_Form::addCheckbox(),
* HTML_Form::returnCheckbox(), HTML_Form::returnCheckboxRow()
$thattr = 'align="right"', $tdattr = '')
* Prints a textarea input
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $width an integer saying how many characters wide
* @param int $height an integer saying how many rows tall the
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayTextareaRow(), HTML_Form::addTextarea(),
* HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
$height = 5 , $maxlength = '', $attr = '')
// {{{ displayTextareaRow()
* Prints a textarea input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $width an integer saying how many characters wide
* @param int $height an integer saying how many rows tall the
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayTextareaRow(), HTML_Form::addTextarea(),
* HTML_Form::returnTextarea(), HTML_Form::returnTextareaRow()
$height = 5 , $maxlength = 0 , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$height, $maxlength, $attr, $thattr,
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $name a string used in the 'name' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displaySubmit(), HTML_Form::addSubmit(),
* HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
function displaySubmit($title = 'Submit Changes', $name = 'submit',
// {{{ displaySubmitRow()
* Prints a submit button inside a table row
* @param string $name a string used in the 'name' attribute
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displaySubmit(), HTML_Form::addSubmit(),
* HTML_Form::returnSubmit(), HTML_Form::returnSubmitRow()
$attr = '', $thattr = 'align="right"', $tdattr = '')
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayResetRow(), HTML_Form::addReset(),
* HTML_Form::returnReset(), HTML_Form::returnResetRow()
function displayReset($title = 'Clear contents', $attr = '')
* Prints a reset button inside a table row
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayReset(), HTML_Form::addReset(),
* HTML_Form::returnReset(), HTML_Form::returnResetRow()
$thattr = 'align="right"', $tdattr = '')
* @param string $name the string used in the 'name' attribute
* @param array $entries an array containing the <options> to be listed.
* The array's keys become the option values and
* the array's values become the visible text.
* @param mixed $default a default value for the element
* @param int $size an integer saying how many rows should be
* @param string $blank if this string is present, an <option> will be
* added to the top of the list that will contain
* the given text in the visible portion and an
* empty string as the value
* @param bool $multiple a bool saying if multiple choices are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displaySelectRow(), HTML_Form::addSelect(),
* HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
function displaySelect($name, $entries, $default = '', $size = 1 ,
$blank = '', $multiple = false , $attr = '')
$blank, $multiple, $attr);
// {{{ displaySelectRow()
* Prints a select list inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param array $entries an array containing the <options> to be listed.
* The array's keys become the option values and
* the array's values become the visible text.
* @param mixed $default a default value for the element
* @param int $size an integer saying how many rows should be
* @param string $blank if this string is present, an <option> will be
* added to the top of the list that will contain
* the given text in the visible portion and an
* empty string as the value
* @param bool $multiple a bool saying if multiple choices are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displaySelect(), HTML_Form::addSelect(),
* HTML_Form::returnSelect(), HTML_Form::returnSelectRow()
$size = 1 , $blank = '', $multiple = false ,
$attr = '', $thattr = 'align="right"', $tdattr = '')
$size, $blank, $multiple, $attr,
* @param string $name the string used in the 'name' attribute
* @param string $src the string denoting the path to the image.
* Can be a relative path or full URI.
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayImageRow(), HTML_Form::addImage(),
* HTML_Form::returnImage(), HTML_Form::returnImageRow()
* @since Method available since Release 1.1.0
* Prints an image input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $src the string denoting the path to the image.
* Can be a relative path or full URI.
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayImage(), HTML_Form::addImage(),
* HTML_Form::returnImage(), HTML_Form::returnImageRow()
* @since Method available since Release 1.1.0
$thattr = 'align="right"', $tdattr = '')
* @param string $name the string used in the 'name' attribute
* @param string $value the string used for the item's value
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::returnHidden(), HTML_Form::addHidden()
// assuming that $default is the 'checked' attribut of the radio tag
* @param string $name the string used in the 'name' attribute
* @param string $value the string used for the item's value
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayRadioRow(), HTML_Form::addRadio(),
* HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
function displayRadio($name, $value, $default = false , $attr = '')
* Prints a radio input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $value the string used for the item's value
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayRadio(), HTML_Form::addRadio(),
* HTML_Form::returnRadio(), HTML_Form::returnRadioRow()
$attr = '', $thattr = 'align="right"', $tdattr = '')
$attr, $thattr, $tdattr);
* @see HTML_Form::displayBlankRow(), HTML_Form::addBlank(),
* HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
* Prints a blank row in the table
* @param int $i the number of rows to create. Ignored if
* @param string $title a string to be used as the label for the row
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayBlank(), HTML_Form::addBlank(),
* HTML_Form::returnBlank(), HTML_Form::returnBlankRow()
* Prints a file upload input
* @param string $name the string used in the 'name' attribute
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayFileRow(), HTML_Form::addFile(),
* HTML_Form::returnFile(), HTML_Form::returnFileRow(),
* HTML_Form::returnMultipleFiles()
function displayFile($name, $maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE , $accept = '',
* Prints a file upload input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayFile(), HTML_Form::addFile(),
* HTML_Form::returnFile(), HTML_Form::returnFileRow(),
* HTML_Form::returnMultipleFiles()
function displayFileRow($name, $title, $maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE , $accept = '',
$attr = '', $thattr = 'align="right"', $tdattr = '')
$size, $accept, $attr, $thattr, $tdattr);
// {{{ displayPlaintext()
* Prints the text provided
* @param string $text a string to be displayed
* @see HTML_Form::displayPlaintextRow(), HTML_Form::addPlaintext(),
* HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
// {{{ displayPlaintextRow()
* Prints the text provided inside a table row
* @param string $title the string used as the label
* @param string $text a string to be displayed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayPlaintext(), HTML_Form::addPlaintext(),
* HTML_Form::returnPlaintext(), HTML_Form::returnPlaintextRow()
$thattr = 'align="right valign="top""',
// =========== RETURN ===========
* Produce a string containing a text input
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayText(), HTML_Form::displayTextRow(),
* HTML_Form::returnTextRow(), HTML_Form::addText()
function returnText($name, $default = '', $size = HTML_FORM_TEXT_SIZE ,
$maxlength = 0 , $attr = '')
$str = '<input type="text" name="' . $name . '" ';
$str .= 'size="' . $size . '" value="' . $default . '" ';
$str .= 'maxlength="' . $maxlength. '" ';
return $str . $attr . "/>\n";
* Produce a string containing a text input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayText(), HTML_Form::displayTextRow(),
* HTML_Form::returnText(), HTML_Form::addText()
$size = HTML_FORM_TEXT_SIZE , $maxlength = 0 ,
$attr = '', $thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a password input
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
* HTML_Form::returnPasswordRow(), HTML_Form::addPassword()
$size = HTML_FORM_PASSWD_SIZE ,
$maxlength = 0 , $attr = '')
$str = '<input type="password" name="' . $name . '" ';
$str .= 'size="' . $size . '" value="' . $default . '" ';
$str .= 'maxlength="' . $maxlength. '" ';
return $str . $attr . "/>\n";
// {{{ returnPasswordRow()
* Produce a string containing a password input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $size an integer used in the 'size' attribute
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayPassword(), HTML_Form::displayPasswordRow(),
* HTML_Form::returnPassword(), HTML_Form::addPassword()
$size = HTML_FORM_PASSWD_SIZE ,
$maxlength = 0 , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a checkbox input
* @param string $name the string used in the 'name' attribute
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
* HTML_Form::returnCheckboxRow(), HTML_Form::addCheckbox()
$str = " <input type=\"checkbox\" name=\"$name\"";
if ($default && $default !== 'off') {
$str .= ' checked="checked"';
return $str . ' ' . $attr . "/>\n";
// {{{ returnCheckboxRow()
* Produce a string containing a checkbox input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayCheckbox(), HTML_Form::displayCheckboxRow(),
* HTML_Form::returnCheckbox(), HTML_Form::addCheckbox()
$thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a textarea input
* @param string $name the string used in the 'name' attribute
* @param mixed $default a default value for the element
* @param int $width an integer saying how many characters wide
* @param int $height an integer saying how many rows tall the
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
* HTML_Form::returnTextareaRow(), HTML_Form::addTextarea()
function returnTextarea($name, $default = '', $width = 40 , $height = 5 ,
$maxlength = 0 , $attr = '')
$str = '<textarea name="' . $name . '" cols="' . $width . '"';
$str .= ' rows="' . $height . '" ';
$str .= 'maxlength="' . $maxlength. '" ';
// {{{ returnTextareaRow()
* Produce a string containing a textarea input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param mixed $default a default value for the element
* @param int $width an integer saying how many characters wide
* @param int $height an integer saying how many rows tall the
* @param int $maxlength an integer used in the 'maxlength' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayTextarea(), HTML_Form::displayTextareaRow(),
* HTML_Form::returnTextareaRow(), HTML_Form::addTextarea()
$height = 5 , $maxlength = 0 , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a submit button
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $name a string used in the 'name' attribute
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
* HTML_Form::returnSubmitRow(), HTML_Form::addSubmit()
function returnSubmit($title = 'Submit Changes', $name = 'submit',
return '<input type="submit" name="' . $name . '"'
. ' value="' . $title . '" ' . $attr . "/>\n";
* Produce a string containing a submit button inside a table row
* @param string $name a string used in the 'name' attribute
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displaySubmit(), HTML_Form::displaySubmitRow(),
* HTML_Form::returnSubmit(), HTML_Form::addSubmit()
$attr = '', $thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . "> </td>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a reset button
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayReset(), HTML_Form::displayResetRow(),
* HTML_Form::returnResetRow(), HTML_Form::addReset()
function returnReset($title = 'Clear contents', $attr = '')
return '<input type="reset"'
. ' value="' . $title . '" ' . $attr . "/>\n";
* Produce a string containing a reset button inside a table row
* NOTE: Unusual parameter order.
* @param string $title a string that appears on the button
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayReset(), HTML_Form::displayResetRow(),
* HTML_Form::returnReset(), HTML_Form::addReset()
$thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . "> </td>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Produce a string containing a select list
* @param string $name the string used in the 'name' attribute
* @param array $entries an array containing the <options> to be listed.
* The array's keys become the option values and
* the array's values become the visible text.
* @param mixed $default a default value for the element
* @param int $size an integer saying how many rows should be
* @param string $blank if this string is present, an <option> will be
* added to the top of the list that will contain
* the given text in the visible portion and an
* empty string as the value
* @param bool $multiple a bool saying if multiple choices are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
* HTML_Form::returnSelectRow(), HTML_Form::addSelect()
function returnSelect($name, $entries, $default = '', $size = 1 ,
$blank = '', $multiple = false , $attr = '')
if ($multiple && substr($name, -2 ) != '[]') {
$str = ' <select name="' . $name . '"';
$str .= ' size="' . $size . '"';
$str .= ' multiple="multiple"';
$str .= ' ' . $attr . ">\n";
$str .= ' <option value="">' . $blank . '</option>' . "\n";
foreach ($entries as $val => $text) {
$str .= 'selected="selected" ';
} elseif ($default == $val) {
$str .= 'selected="selected" ';
$str .= 'value="' . $val . '">' . $text . "</option>\n";
* Produce a string containing a select list inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param array $entries an array containing the <options> to be listed.
* The array's keys become the option values and
* the array's values become the visible text.
* @param mixed $default a default value for the element
* @param int $size an integer saying how many rows should be
* @param string $blank if this string is present, an <option> will be
* added to the top of the list that will contain
* the given text in the visible portion and an
* empty string as the value
* @param bool $multiple a bool saying if multiple choices are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displaySelect(), HTML_Form::displaySelectRow(),
* HTML_Form::returnSelect(), HTML_Form::addSelect()
function returnSelectRow($name, $title, $entries, $default = '', $size = 1 ,
$blank = '', $multiple = false , $attr = '',
$thattr = 'align="right"', $tdattr = '')
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n";
$blank, $multiple, $attr);
* Produce a string containing a radio input
* @param string $name the string used in the 'name' attribute
* @param string $value the string used for the item's value
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
* HTML_Form::returnRadioRow(), HTML_Form::addRadio()
* @since Method available since Release 1.1.0
function returnRadio($name, $value, $default = false , $attr = '')
return '<input type="radio" name="' . $name . '"' .
' value="' . $value . '"' .
($default ? ' checked="checked"' : '') .
* Produce a string containing a radio input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $value the string used for the item's value
* @param bool $default a bool indicating if item should be checked
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayRadio(), HTML_Form::displayRadioRow(),
* HTML_Form::returnRadio(), HTML_Form::addRadio()
* @since Method available since Release 1.1.0
$attr = '', $thattr = 'align="right"', $tdattr = '')
' <th ' . $thattr . '>' . $title . ":</th>\n" .
' <td ' . $tdattr . ">\n " .
* Produce a string containing an image input
* @param string $name the string used in the 'name' attribute
* @param string $src the string denoting the path to the image.
* Can be a relative path or full URI.
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayImage(), HTML_Form::displayImageRow(),
* HTML_Form::returnImageRow(), HTML_Form::addImage()
* @since Method available since Release 1.1.0
return '<input type="image" name="' . $name . '"' .
' src="' . $src . '" ' . $attr . "/>\n";
* Produce a string containing an image input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param string $src the string denoting the path to the image.
* Can be a relative path or full URI.
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayImage(), HTML_Form::displayImageRow(),
* HTML_Form::returnImage(), HTML_Form::addImage()
* @since Method available since Release 1.1.0
$thattr = 'align="right"', $tdattr = '')
' <th ' . $thattr . '>' . $title . ":</th>\n" .
' <td ' . $tdattr . ">\n " .
* Produce a string containing a hiden input
* @param string $name the string used in the 'name' attribute
* @param string $value the string used for the item's value
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayHidden(), HTML_Form::addHidden()
return '<input type="hidden" name="' . $name . '"'
. ' value="' . $value . '" ' . $attr . "/>\n";
* Produce a string containing
* @see HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
* HTML_Form::returnBlankRow(), HTML_Form::addBlank()
* @since Method available since Release 1.1.0
* Produce a string containing a blank row in the table
* @param int $i the number of rows to create. Ignored if
* @param string $title a string to be used as the label for the row
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayBlank(), HTML_Form::displayBlankRow(),
* HTML_Form::returnBlank(), HTML_Form::addBlank()
* @since Method available since Release 1.1.0
for ($j = 0; $j < $i; $j++ ) {
$str .= ' <th ' . $thattr . "> </th>\n";
' <th ' . $thattr . '>' . $title . ":</th>\n" .
* Produce a string containing a file upload input
* @param string $name the string used in the 'name' attribute
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
* HTML_Form::returnFileRow(), HTML_Form::addFile(),
* HTML_Form::returnMultipleFiles()
$maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE ,
$accept = '', $attr = '')
$str = ' <input type="hidden" name="MAX_FILE_SIZE" value="';
$str .= $maxsize . "\" />\n";
$str .= ' <input type="file" name="' . $name . '"';
$str .= ' size="' . $size . '" ';
$str .= 'accept="' . $accept . '" ';
return $str . $attr . "/>\n";
* Produce a string containing a file upload input inside a table row
* @param string $name the string used in the 'name' attribute
* @param string $title the string used as the label
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
* HTML_Form::returnFile(), HTML_Form::addFile(),
* HTML_Form::returnMultipleFiles()
function returnFileRow($name, $title, $maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE ,
$accept = '', $attr = '', $thattr = 'align="right"',
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n";
// {{{ returnMultipleFiles()
* Produce a string containing a file upload input
* @param string $name the string used in the 'name' attribute
* @param int $maxsize an integer determining how large (in bytes) a
* @param int $files an integer of how many file inputs to show
* @param int $size an integer used in the 'size' attribute
* @param string $accept a string saying which MIME types are allowed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @see HTML_Form::displayFile(), HTML_Form::displayFileRow(),
* HTML_Form::returnFile(), HTML_Form::returnFileRow(),
$maxsize = HTML_FORM_MAX_FILE_SIZE ,
$size = HTML_FORM_TEXT_SIZE ,
$accept = '', $attr = '')
$str = '<input type="hidden" name="MAX_FILE_SIZE" value="';
$str .= $maxsize . "\" />\n";
for($i=0; $i < $files; $i++ ) {
$str .= '<input type="file" name="' . $name . '"';
$str .= ' size="' . $size . '" ';
$str .= 'accept="' . $accept . '" ';
$str .= $attr . "/><br />\n";
* Produces a string containing the opening tags for the form and table
* NOTE: can NOT be called statically.
* @param bool $multipartformdata a bool indicating if the form should
* be submitted in multipart format
* @see HTML_Form::display(), HTML_Form::returnEnd(), HTML_Form::start()
$str = "<form action=\"" . $this->action . " \" method=\"$this->method\"";
$str .= " name=\"$this->name\"";
$str .= " target=\"$this->target\"";
$str .= " enctype=\"$this->enctype\"";
if ($multipartformdata) {
$str .= " enctype=\"multipart/form-data\"";
return $str . ' ' . $this->attr . ">\n";
* Produces a string containing the opening tags for the form and table
* NOTE: can NOT be called statically.
* @see HTML_Form::display(), HTML_Form::returnStart(), HTML_Form::start()
foreach ($this->fields as $i => $data) {
$fields[$data[1 ]] = true;
* Produce a string containing the text provided
* @param string $text a string to be displayed
* @see HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
* HTML_Form::returnPlaintextRow(), HTML_Form::addPlaintext()
// {{{ returnPlaintextRow()
* Produce a string containing the text provided inside a table row
* @param string $title the string used as the label
* @param string $text a string to be displayed
* @param string $attr a string of additional attributes to be put
* in the element (example: 'id="foo"')
* @param string $thattr a string of additional attributes to be put
* in the <th> element (example: 'class="foo"')
* @param string $tdattr a string of additional attributes to be put
* in the <td> element (example: 'class="foo"')
* @see HTML_Form::displayPlaintext(), HTML_Form::displayPlaintextRow(),
* HTML_Form::returnPlaintext(), HTML_Form::addPlaintext()
$thattr = 'align="right" valign="top"',
$str .= ' <th ' . $thattr . '>' . $title . ":</th>\n";
$str .= ' <td ' . $tdattr . ">\n ";
* Prints a complete form with all fields you specified via
* If the $_GET/$_POST supreglobal don't exist, then
* $HTTP_GET_VARS/$HTTP_POST_VARS is used.
* NOTE: can NOT be called statically.
* @see HTML_Form::end(), HTML_Form::end()
$arrname = 'HTTP' . $arrname . '_VARS';
if (isset ($GLOBALS[$arrname])) {
$arr = & $GLOBALS[$arrname];
foreach ($this->fields as $i => $data) {
* $params = the number of arguments the add*() methods have
* $defind = the number of them that have default values
$str = '$this->display' . ucfirst($data[0 ]) . 'Row(';
for ($i = 1; $i <= $params; $i++ ) {
if ($i == $defind && $data[$defind] === null &&
$str .= '$arr[\'' . $data[1 ] . '\']';
$str .= '$data[' . $i . ']';
if ($i < $params) $str .= ', ';
for ($i = 0; $i < sizeof($hidden); $i++ ) {
$this->fields[$hidden[$i]][2 ],
$this->fields[$hidden[$i]][3 ]);
Documentation generated on Mon, 11 Mar 2019 13:51:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|