Re: quickform checkbox qustion (close but not quite working)
| From: | Charles Kline | Date: | Sun, 30 Mar 2003 19:47:28 +0000 |
| Subject: | Re: quickform checkbox qustion (close but not quite working) | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4531@lists.php.net to get a copy of this message | ||
Thank you for the reply. I will try that - have just not used that technique before.
- Charles
On Sunday, March 30, 2003, at 02:36 PM, Bertrand Mansion wrote:
<ckline@rightcode.net> wrote :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.Hi, That's the way QuickForm handles checkboxes, you can't change it. You can still use array_keys($array) or array_keys($array, 1) to process your checkboxes array. Bertrand Mansion Mamasam -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php