QuickForm: preset select field with values from database
| From: | Tobias Franke | Date: | Wed, 07 Apr 2004 17:48:52 +0000 |
| Subject: | QuickForm: preset select field with values from database | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11722@lists.php.net to get a copy of this message | ||
Hi list,
I want to use
$f->addElement('select','companyID','Company Name',$arrayFromDb);
where $arrayFromDb shall be filled with data from mySQL. The database connection is set up properly.
I have already found a method HTML_QuickForm_select::loadQuery() which is supposed to retrieve data from a database and put it into an array to be printed (if you pass the right parameters as I think I did).
I included this special file (HTML/QuickForm/select.php) and created a new object from that class though I am not absolutely sure whether this is the right method or not.
My select field keeps empty and I could not figure out why.
I am using the latest version of all files needed.
The manual/documentation says that loadQuery() throws PEAR::Error but does not return anything.
That´s why I had a closer look at the method which passes the parameters to another method of the same class called loadDbResult() and so on.
Has anybody gained experience in preseting select fields with data from db?
Proposals of any kind are much appreciated :-)
Thanks,
Tobi