Re: HTML_QuickForm loadDbResult into Select Field
| From: | Bertrand Mansion | Date: | Wed, 15 May 2002 16:01:37 +0000 |
| Subject: | Re: HTML_QuickForm loadDbResult into Select Field | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1378@lists.php.net to get a copy of this message | ||
le 15/05/02 17:48, Frank Thiel à thier6@gmx.de a écrit :
> Hi!
> I´m new into classes!
> The HTML_QuickForm class is great.
>
> I´m searching for an example to load db results into a select field of the
> HTML_QuickForm.
>
> I found the function loadDbResult, but i don´t know how i use these
> function.
> How do i use this function in my form?
>
> The normal way looks like this:
>
> $form->addElement('select', 'iselTest', 'Test Select:',
> array('A'=>'A',
>
> 'B'=>'B','C'=>'C','D'=>'D'));
>
> This example is from the example :)
You should be able to do it that way:
$form->addElement('select', 'iselTest', 'Test Select:');
$select = &$form->getElement('iselTest');
$select->loadDbResult($result);
This can work because $select is a reference.
$result is a PEAR DB result object.
Refer to the select.php code for the other parameters.
Good luck,
Bertrand Mansion
Mamasam