Home » HTML » HTML_QuickForm » Bug #1212
Database entries in select
Details
| Submitted | 2004-04-15 04:28 UTC |
|---|---|
| From | djpenton at cs dot mu dot oz dot au |
| Assigned | avb |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | 5CVS-2004-04-15 (dev) |
| OS | Solaris 2.9 |
| Roadmaps | (Not assigned) |
Comments
[2004-04-15 04:28 UTC] djpenton at cs dot mu dot oz dot au
Description:
------------
line 447:
case (get_class($options) == "db_result" || is_subclass_of($options, "db_result")):
Should read:
case (is_a($options, "db_result") || is_subclass_of($options, "db_result")):
The case of the class is represented differently in php5 and hence it doesn't match DB_result with db_result.
(Works fine in php4)
Reproduce code:
---------------
$user = DBASE_USER;
$pass = DBASE_PASS;
$host = MYSQL_HOST;
$db_name = MYSQL_DBNAME;
$dsn = "mysql://$user:$pass@$host/$db_name";
$db = DB::connect($dsn);
$form = new HTML_QuickForm('firstForm');
$form->addElement('header', null, 'QuickForm tutorial example');
$form->addElement('select',"elementname","label",$db->query("SELECT optionName, birthdateConfidence FROM BirthdateConfidenceSet"));
$form->addElement('submit', null, 'Send');
if ($form->validate()) {
echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('elementname')) . '!</h1>';
exit;
}
$form->display();
Expected result:
----------------
a dropdown select
Actual result:
--------------
empty select box