http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html
libHtmlForm for PHP.
Release 1.0.0
http://www.nirvani.net/software/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Prototypes:
html_textarea($name, $value='', $cols=40, $rows=5)
html_input_hidden($name, $value)
html_input_radio($name, $value, $checked=FALSE)
html_input_checkbox($name, $value, $checked=FALSE)
html_input_text($name, $value='', $size=20, $maxlength=100)
html_input_password($name, $value='', $size=20, $maxlength=100)
html_input_submit($name='button', $value=' GO ')
html_input_reset($value=' CANCEL ')
html_select($name, $value_description_array, $value_selected='',
$size=1, $multiple=FALSE)
See each individual function for full usage!!!
**/
function html_textarea($name, $value='', $cols=40, $rows=5)
{
/** wrap="virtual" is not part of any W3C HTML standard; at least
** up to 4.01, but nearly any decent browser knows it, and if
** it doesn't oh well. It is too nice to not include here. **/
$buf = '';
return $buf;
}
function html_input_hidden($name, $value)
{
$buf = '';
return $buf;
}
function html_input_radio($name, $value, $checked=FALSE)
{
/** The following allows for making sure that no two radio buttons
** of the same name can ever be checked. Once one is checked, no
** subsequent ones will be allowed to be checked. I used md5 just because it
** produces a unique hash where all characters are valid for a variable
** name in PHP and which is then made into the static variable
** which is where the state is saved.
** ChangeLog.
** Had to use 'global' instead of static. Static was erroring out
** for some reason. **/
$namesum = md5($name);
$state = 'radio_' . $namesum;
global $$state;
$tmp = '';
if ($checked && !$$state)
{
$$state = TRUE;
$tmp = ' checked';
}
$buf = '';
unset($tmp); unset($state);
return $buf;
}
function html_input_checkbox($name, $value, $checked=FALSE)
{
$tmp = '';
if ($checked)
$tmp = ' checked';
$buf = '';
return $buf;
}
function html_input_text($name, $value='', $size=20, $maxlength=100)
{
if ($size > $maxlength)
$size = $maxlength;
if (strlen($value) > $maxlength)
$value = substr($value, 0, $maxlength);
$buf = '';
return $buf;
}
function html_input_password($name, $value='', $size=20, $maxlength=100)
{
if ($size > $maxlength)
$size = $maxlength;
if (strlen($value) > $maxlength)
$value = substr($value, 0, $maxlength);
$buf = '';
return $buf;
}
function html_input_submit($name='button', $value=' GO ')
{
$buf = '';
return $buf;
}
function html_input_reset($value=' CANCEL ')
{
$buf = '';
return $buf;
}
function html_select($name, $value_description_array, $value_selected='', $size=1, $multiple=FALSE)
{
$num_elements = count($value_description_array);
if ($size > $num_elements)
$size = $num_elements;
$mul = '';
if ($multiple)
$mul = ' multiple';
$buf = '';
return $buf;
}
?>