html_quickform adding items dynamically
| From: | rav k | Date: | Tue, 19 Dec 2006 14:20:04 +0000 |
| Subject: | html_quickform adding items dynamically | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26156@lists.php.net to get a copy of this message | ||
Hi
I'm trying to change my code to do the following: I want to look in a table get all the skills and then add checkboxes for each skill and a textarea next to the checkbox. The user can then click on a checkbox and then write a comment in the textarea next to it.
This is how I am adding the checkboxes:
/* ADD THE SKILLS */
$res =& $mdb2->query('SELECT * FROM Skills');
$skills = array();
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$skills[] = &HTML_QuickForm::createElement('advcheckbox', $row['skillid'], null,'<b>'.$row['skillname'].'</b>'.' : '.$row['description'],null,$row['skillid']);
$requirements[] = &HTML_QuickForm::createElement('textarea', $row['skillid'], '', 'rows=10 cols=30');
}
$form->addGroup($skills, 'skills', 'Your skills:', '<br />');
What I have done in the above example is added $requirements[] which is supposed to add the textareas next to each checkbox. I don't think this is correct however as I'm not sure how to add the group.
Can anyone help please??
Thanks
rav
_________________________________________________________________
Windows Live Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb