|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-04-13 20:50 UTC] jellybob@php.net
When using a select element in a Quickform, if you later try to retrieve the value with getElementValue, it returns it as the string Array (not as an Array, but just the string).
Example:
$form = new HTML_QuickForm('example', 'post');
$select = &$form->addElement('select', 'bob');
$select->addOption('option1', '1');
$select->addOption('option2', '2');
$select->addElement('submit', null, 'Submit');
if ($form->validate) {
print_r($form->getElementValue('bob');
}
Outputs:
Array
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 22:00:01 2025 UTC |
I have tested with this code and it was working fine. require_once('HTML/QuickForm.php'); $form = new HTML_QuickForm(); $select =& $form->addElement('select', 'bob'); $select->addOption('option1', '1'); $select->addOption('option2', '2'); $form->addElement('submit', null, 'Submit'); if ($form->validate()) { print_r($form->getElementValue('bob')); } $form->display(); Could you tell me which QuickForm release you are using ? Thanks, Bertrand Mansion Mamasam