QuickForm issue
| From: | David Dahl | Date: | Mon, 17 Jun 2002 04:57:57 +0000 |
| Subject: | QuickForm issue | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1683@lists.php.net to get a copy of this message | ||
this code does some wierd things to this form i am trying to populate form a database connection:
while ($row = $getUserData->fetchRow(DB_FETCHMODE_ASSOC)){
$userFormEdit = new HTML_QuickForm('users1', 'POST');
$userFormEdit->addHeader('Edit Association User');
$userFormEdit->addElement('hidden', 'a', 'users');
$userFormEdit->addElement('hidden', 'sub', 'edit_user2');
$userFormEdit->addElement('hidden', 'user_id', $user_id);
$defaultValues['name'] = array('namel'=>'$row[namel]', 'namef'=>'$row[namef]');
$name['namel'] = &HTML_QuickForm::createElement('text', 'namef');
$name['namel']->setSize(20);
$name['namef'] = &HTML_QuickForm::createElement('text', 'namel');
$name['namef']->setSize(20);
$userFormEdit->addElementGroup($name, 'Name (last, first):', 'name', ', ');
$userFormEdit->addElement('text', 'namel', 'Last Name', $row[namel]);
$userFormEdit->addElement('text', 'namef', 'First Name', $row[namef]);
$userFormEdit->addElement('text', 'username', 'Username', $row[username]);
$userFormEdit->addElement('password', 'password', 'Password', $row[password]);
$userFormEdit->addElement('textarea', 'comments', 'Comments', $row[comments]);
$buttons2[] = &HTML_QuickForm::createElement('submit', null, 'View');
$buttons2[] = &HTML_QuickForm::createElement('reset', null, 'Reset');
$userFormEdit->addElementGroup($buttons2);
$userFormDisplayEdit = $userFormEdit->toHTML();
}
Here is part of the output:
<tr>
<td align="right" valign="top"><b>Name (last, first):</b></td>
<td nowrap="nowrap" valign="top" align="left"><input name="name[namef]" type="text" size="20" />, <input name="name[namel]" type="text" size="20" /></td>
</tr>
<tr>
<td align="right" valign="top"><b>Last Name</b></td>
<td nowrap="nowrap" valign="top" align="left"><input dahl="dahl" name="namel" type="text" /></td>
</tr>
<tr>
<td align="right" valign="top"><b>First Name</b></td>
<td nowrap="nowrap" valign="top" align="left"><input david="david" name="namef" type="text" /></td>
</tr>
It does not place the data from the database into a "VALUE=DATA" statement in the form. Why do I end up with "david=david" in the input
perplexing...
David