Quickform: adding multiple radio elements using loop - trouble setting checked
| From: | l Burnerheimerton | Date: | Mon, 12 Dec 2005 20:47:45 +0000 |
| Subject: | Quickform: adding multiple radio elements using loop - trouble setting checked | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22221@lists.php.net to get a copy of this message | ||
I get a DB resultset, $results, then:
...
$ma[] =& $form->createElement
('radio','action',null,'Do','D' );
$ma[] =& $form->createElement
('radio','action',null,'Do Not','N');
while ($row =& $results->fetchRow()) {
$var = 'number';
$$var = $row[0];
$form->setDefaults(array("$var ${$var}" => $row[2]));
$form->addGroup ( $g,"$var ${$var}", $row[1].' :' );
}
$row[2] contains the value, "D" or "N" in the database
assoicated with each record. It SHOULD set the
checked value of each radio button. What it is doing
is setting ALL checked values equal to the $row[2] of
the last record in the loop.
How to correct this?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com