http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html libHtmlForm for PHP. Release 1.2.0-test1 http://www.nirvani.net/software/ "It is a continuous aim of this software to provide compatibility with even the oldest web browsers up through the most current." -- Jeremy Brand , February 2002. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, Version 2 as published by the Free Software Foundation. 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 ChangeLog: 1.2.0 -> Jeremy Brand New functions: html_input_checkbox_table(), html_input_radio_table(), These 2 new functions are nice alternatives for multiple or single s require the use of the [CRTL] key plus mouse clicks and who knows off-hand {not me} what key+mouse combination is used on a Macintosh (TM) or other random environments when using multiple '; 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 this specific ** variable name in PHP and which is then made into a global variable ** which is where the state gets 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) ($maxlength <=0) ? $maxlength = $size : $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; }/*}}}*/ function html_input_radio_table($name, $value_description_array, $value_selected, $columns=3, $table_border=0, $cellspacing=0, $cellpadding=2, $other_table_string='')/*{{{*/ { $num_records = count($value_description_array); if (!$num_records) return ''; $height = ceil($num_records / $columns); if (strlen($other_table_string)) $other_table_string = ' '.trim($other_table_string); $buf = ''."\n"; for ($y=1; $y<=$height; $y++) { $buf .= ''; for ($x=1; $x<=$columns; $x++) { $count++; list($key, $val) = each($value_description_array); if (strlen($key)) { $er = error_reporting(0); $checked = FALSE; if ($value_selected == $key) $checked = TRUE; $buf .= ''; error_reporting($er); } else $buf .= ''; } $buf .= ''."\n"; } $buf .= '
'.html_input_radio($name, $key, $checked).' '.$val.'    
'; return $buf; }/*}}}*/ function html_input_checkbox_table($name, $value_description_array, $value_selected_array, $columns=3, $table_border=0, $cellspacing=0, $cellpadding=2, $other_table_string='')/*{{{*/ { $num_records = count($value_description_array); if (!$num_records) return ''; $height = ceil($num_records / $columns); if (strlen($other_table_string)) $other_table_string = ' '.trim($other_table_string); $buf = ''."\n"; for ($y=1; $y<=$height; $y++) { $buf .= ''; for ($x=1; $x<=$columns; $x++) { $count++; list($key, $val) = each($value_description_array); if (strlen($key)) { $er = error_reporting(0); $checked = FALSE; if (in_array($key, $value_selected_array)) $checked = TRUE; $buf .= ''; error_reporting($er); } else $buf .= ''; } $buf .= ''."\n"; } $buf .= '
'.html_input_checkbox($name, $key, $checked).' '.$val.'    
'; return $buf; }/*}}}*/ ?>