[HTML Quickform] addElement(-,-,-, array('value' => ... doesn't work
| From: | Damien Cros | Date: | Wed, 28 Sep 2005 13:57:56 +0000 |
| Subject: | [HTML Quickform] addElement(-,-,-, array('value' => ... doesn't work | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21125@lists.php.net to get a copy of this message | ||
Hi!
Here's a sample code of the problem I have:
$myproduct = isset($_REQUEST['txtSource'])?$_REQUEST['txtSource']:'';
$form = new HTML_QuickForm('frm', 'POST');
if($myproduct != "")
{
Attachment: [application/pkcs7-signature] smime.p7s
$select = "select PRODUCTNAME from PRODUCTS where PRODUCTNAME = '".$selectedDomain."'";
$product = $db -> getOne($select);
$productName = array('value' => $product);
}
$form->addElement('text', 'txtSource', "Input");
$form->addElement ('submit', 'btnSubmit', "Submit");
$form->addElement('text', 'txtProductName', 'product name', $productName);
$form->display();
This is just an example.
The user enters something in the txtSource field, then he submits the form, the database returns a string that is then shown in the txtProductName field.
Well, that's the idea. But it doesn't work.
txtProductName is always empty. I don't know why because $product is not empty??
I've also tried using setDefaults but it doesn't work either.
If you have any idea...
damien
Attachment: [application/pkcs7-signature] smime.p7s