Re: getAll() and HTML_QuickForm help needed please
| From: | Thomas Schulz | Date: | Tue, 25 Feb 2003 02:08:18 +0000 |
| Subject: | Re: getAll() and HTML_QuickForm help needed please | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3934@lists.php.net to get a copy of this message | ||
Charles Kline schrieb in php.pear.general:
> I am trying to move a form of mine over to HTML_QuickForm and am not
> sure how to get the values of an array created with getAll() into my
> HTML_QuickForm select element.
>
> Here is what I have:
>
> // query
> $sql = "SELECT *
> FROM tbl_dra
> WHERE 1
> ORDER BY area ASC";
>
> $qa = $db->getAll($sql, DB_FETCHMODE_ASSOC);
As I remember right you can try this:
$sql = "SELECT id, area
FROM tbl_dra
WHERE 1
ORDER BY area ASC";
$qa = $db->getAssoc($sql);
> Looking at the examples in the docs, I see that I need to populate the
> select like this:
>
> $form->addElement('select', 'iselTest', 'Test Select:',
> array('A'=>'A',
>
> 'B'=>'B','C'=>'C','D'=>'D'));
$form->addElement('select', 'iselTest', 'Test Select:', $qa);
Hope this work as espected...
Thomas.
--
http://4bconsult.de