HTML_QuickForm - Problem with setValue
| From: | Marcus Krause | Date: | Tue, 08 Jun 2004 13:44:13 +0000 |
| Subject: | HTML_QuickForm - Problem with setValue | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13007@lists.php.net to get a copy of this message | ||
I'm trying to build an form that enables users to send an eMail to a
specified group of user. Username and ID of mail_address comes from
DB. Every recipient should be selected by an checkbox.
I don't want to publish the user's email, and so the value of each
input field should be only the ID of mail_address.
After processing the form, the data should be accessable in following
Array S_POST['addresses']!
That's the way it's not working yet:
-----------------------------------------------------------------------
$form = new HTML_QuickForm('emailform','post');
$checkbox = array();
while ($email_row = $dbres_user->fetchRow()) // DATA FROM DB
{
$checkbox[] =
HTML_QuickForm::createElement('advcheckbox',null,null,$email_row->lname.',
'.$email_row->fname,"'".$email_row->id."'");
}
$form->addGroup($checkbox,'addresses[]','Recipient:','<br
/>');
-----------------------------------------------------------------------
another not working way:
-----------------------------------------------------------------------
$form = new HTML_QuickForm('emailform','post');
$checkbox = array();
while ($email_row = $dbres_user->fetchRow()) // DATA FROM DB
{
$tmp_checkbox =
HTML_QuickForm::createElement('checkbox',null,null,$email_row->lname.',
'.$email_row->fname);
$tmp_checkbox->setValue($email_row->id);
$checkbox[] = $tmp_checkbox;
}
$form->addGroup($checkbox,'addresses[]','Recipient:','<br
/>');
-----------------------------------------------------------------------
In both ways it only provides value="1"; in the first case also an
additional bit of javascript within each input-tag!
How can I get the desired (example) array(3,5,79,43)?
PS: type of $email_row->lname : string
type of $email_row->fname : string
type of $email_row->id : integer