[thelist] php: how to reselect a checkbox on page reload

Jeff Howden jeff at jeffhowden.com
Sat Aug 9 11:42:55 CDT 2003


kelly,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Kelly Hallman
>
> function checkbox_group($cbarr,$formitem,$formname) {
>     foreach($cbarr as $k => $v) {
>         $ret.= '<input type="checkbox" name="'.
>                $formname.'" id="'.$k.'" value="'.$v.
>                '" '. (is_array($formitem)
>                && in_array($v,$formitem)?"CHECKED ":"").
>                '/>\n'; }
>     return $ret; }
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i'm no php person, but if you're going to be using xhtml syntax for your
<input /> tags, shouldn't your compact attributes be expanded (and
lowercase)?

<input type="checkbox" name="foo" id="foo" value="1" checked="checked" />

.jeff

------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/




More information about the thelist mailing list