For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > December 2005 > Quickform - looping through DB result set to create multiple records and radio button









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Quickform - looping through DB result set to create multiple records and radio button
l Burnerheimerton

2005-12-10, 7:11 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com