Source for file forms.php
Documentation is available at forms.php
* forms.php - html form functions
* Functions to build HTML forms in a safe and consistent manner.
* All name, value attributes are htmlentitied.
* @link http://www.section508.gov/ Section 508
* @link http://www.w3.org/WAI/ Web Accessibility Initiative (WAI)
* @link http://www.w3.org/TR/html4/ W3.org HTML 4.01 form specs
* @copyright © 2004-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: forms.php,v 1.3.2.13 2006/04/14 22:27:07 jervfors Exp $
* Helper function to create form fields, not to be called directly,
* only by other functions below.
function addInputField($type, $name =
null, $value =
null, $attributes =
'') {
return '<input type="'.
$type.
'"'.
function addCheckBox($name, $checked =
false, $value =
null) {
($checked ?
' checked="checked"' :
''));
function addRadioBox($name, $checked =
false, $value =
null) {
($checked ?
' checked="checked"' :
''));
function addInput($name, $value =
'', $size =
0, $maxlength =
0) {
$attr.=
' size="'.(int)
$size.
'"';
$attr.=
' maxlength="'.(int)
$maxlength .
'"';
* Function to create a selectlist from an array.
* name: html name attribute
* values: array ( key => value ) -> <option value="key">value</option>
* default: the key that will be selected
* usekeys: use the keys of the array as option value or not
function addSelect($name, $values, $default =
null, $usekeys =
false)
if(count($values) ==
1) {
foreach ($values as $k =>
$v) {
$ret .=
'<option value="' .
(($default ==
$k) ?
' selected="selected"' :
'') .
* Note the switched value/name parameters!
* Form reset button, $value = caption
function addTextArea($name, $text =
'', $cols =
40, $rows =
10, $attr =
'') {
'rows="'.(int)
$rows .
'" cols="'.(int)
$cols.
'" '.
* Make a <form> start-tag.
function addForm($action, $method =
'post', $name =
'', $enctype =
'', $charset =
'')
$name =
' name="'.
$name.
'"';
$enctype =
' enctype="'.
$enctype.
'"';
return '<form action="'.
$action .
'" method="'.
$method .
'"'.
$enctype .
$name .
$charset .
">\n";
Documentation generated on Sat, 07 Oct 2006 16:31:21 +0300 by phpDocumentor 1.3.0RC6