How to use HTML_Table with HTML_QuickForm

From: Date: Wed, 17 Aug 2005 01:12:44 +0000
Subject: How to use HTML_Table with HTML_QuickForm
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20437@lists.php.net to get a copy of this message
Hello there, I want to use HTML_QuickForm in HTML_Table, for example, here is my simple script: <?php require_once "HTML/QuickForm.php"; require_once "HTML/Table.php"; $tableForm = new HTML_QuickForm('tableForm', 'POST'); $tableStyle = "border=1 width=450"; $table = new HTML_Table($tableStyle); $table->setAutoGrow(true); $table->setCaption('Example'); $rowHeaders = array('checkbox', 'id', 'name'); $table->addRow($rowHeaders); $table->setRowAttributes(0, "bgcolor=#99CCCC align=center"); $table->addRow(array($tableForm->addElement('checkbox', 'st["OG012"]'), 'OG012', 'Joe')); $table->addRow(array($tableForm->addElement('checkbox', 'st["OG013"]'), 'OG013', 'Mary')); $tableForm->addElement('submit', 'submit', 'Submit'); if ($tableForm->validate()) { $packages = $tableForm->exportValues(); foreach ($packages["kk"] as $pkg => $bool) { print "{$pkg}\n"; } } else { $table->display(); } ?> The problem is if I want to display "submit" button($tableForm->display()), I will see extra two checkbox elements. Would you tell me how to do the correct way that I can use checkbox in table and display submit correctly? Thanks. Regards, Joe

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