mpiantella — 2011-05-22T00:35:29-04:00 — #1
I'm trying to create my first form using PEAR QuickForm2, following the PHP Anthology SP book. Now my php server gives me this error:
Catchable fatal error: Argument 4 passed to HTML_QuickForm2_Container::addElement() must be an array, string given, called in C:\\my_server_dir\\phpQuickForm\\HTMLForm.php on line 7 and defined in C:\\php\\PEAR\\HTML\\QuickForm2\\Container.php on line 246
I checked the Container.php file of QuickForm and is correct,
requires an array to be passed as the last argument. What's wrong here?
speda1 — 2011-05-22T13:44:17-04:00 — #2
C:\my_server_dir\phpQuickForm\HTMLForm.php on line 7 isn't passing an array as argument 4 into addElement().
mpiantella — 2011-05-22T16:38:40-04:00 — #3
Thank you and I get that the script is not passing an array as the foruth argument, which is required by the addElement() function. So this is the code
$form = new HTML_QuickForm('Create', 'post', basename(__FILE__));
// Our Default Form Options
$opts = array('size' => 20, 'maxlength' => 255);
// Add our form elements
[B]$form->addElement('static', 'header', null,
So I guess my question is:
-Is the code from the book not updated or did I do something wrong at installation?
typodrifter — 2013-02-06T06:00:49-05:00 — #4
The arguments from QuickForm2 are different than QuickForm. Check the documentation on PEAR site to see the differences. There is a section there that explains the difference.
Here is a link to page which shows examples:
Have fun, be patient - I'm learning the hard way too!!!