Setting checkbox values with QuickForm
| From: | roguecfm | Date: | Sun, 30 Mar 2003 18:51:49 +0000 |
| Subject: | Setting checkbox values with QuickForm | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4526@lists.php.net to get a copy of this message | ||
**Sorry if this is a repost. I sent this message 20
min. ago and never saw it on the list.**
hi all,
i can't figure out exactly how to get my group of
checkboxes to contain the right data. here is what i
have:
foreach ($sth as $k=>$v){
$checkbox[] =
&HTML_QuickForm::createElement('checkbox', $k, null,
$v);
}
$ib_form->addGroup($checkbox, 'ib_article', 'Choose
source articles:', array(' ', '<br />'));
this gives me this set of checkboxes:
<input name="ib_article[30]" type="checkbox" value="1"
/>Article A <input name="ib_article[20]"
type="checkbox" value="1" />Article B<br /><input
name="ib_article[31]" type="checkbox" value="1"
/>Article C
this is almost there, but what i want to have is this:
<input name="ib_article[]" type="checkbox" value="30"
/>Article A <input name="ib_article[]"
type="checkbox" value="20" />Article B<br /><input
name="ib_article[]" type="checkbox" value="31"
/>Article C
where the value="" is the value of $k and the name is
just ib_article[] - the $v is showing up just the way
i like it right now.
how is this achieved? thanks.
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com