Re: Quickform - looping through DB result set to create multiple records and radio buttons for each record
| From: | Mark Wiesemann | Date: | Sat, 10 Dec 2005 21:31:44 +0000 |
| Subject: | Re: Quickform - looping through DB result set to create multiple records and radio buttons for each record | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22196@lists.php.net to get a copy of this message | ||
l Burnerheimerton wrote:
> while ($row =& $resultSet->fetchRow()) {
Either insert here $ma = array(); ...
> $ma[] =& $form->createElement
> ('radio','type',null,'A','A');
> $ma[] =& $form->createElement
> ('radio','type',null,'B','B');
> $ma[] =& $form->createElement
> ('radio','type',null,'C','C');
> $form->addGroup ( $ma, 'radio'.$row[0], $row[1].' :'
> );
> }
>
> The problem is that it continually uses $ma for each
> different record and adds three new radios to each new
> record - not good.
>
> I need to figure out a way dynamically change the
> variable name, $ma, to $ma.$row[0] or something like
> that.
Or: RTFM!
http://www.php.net/manual/en/language.variables.variable.php
HTH,
Mark