Quickform - looping through DB result set to create multiple records and radio buttons for each record

From: Date: Sat, 10 Dec 2005 20:26:26 +0000
Subject: Quickform - looping through DB result set to create multiple records and radio buttons for each record
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22195@lists.php.net to get a copy of this message
I get a result set form DB of names($row[1]) and a ID field($row[0]). With this, I loop through the result set and create a form element and radio button for each. Like: while ($row =& $resultSet->fetchRow()) { $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. I tried $ma.$row[0] and it throws error: Parse error: parse error, unexpected '[' Any ideas how to accomplish this? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

« previous php.pear.general (#22195) next »