Quickform: problem with register globals on
| From: | Jeroen Houben | Date: | Fri, 14 Mar 2003 11:36:06 +0000 |
| Subject: | Quickform: problem with register globals on | ||
| Groups: | php.pear.dev php.pear.general | ||
| Request: | Send a blank email to pear-dev+get-14288@lists.php.net to get a copy of this message | ||
Hi,
I've finally found the error that has been bugging me for a couple of hours now. My quickform code gives me an error on my live server but works fine on my development machine.
Fatal error: Call to a member function on a non-object in /usr/local/share/php/pear/HTML/QuickForm/group.php on line 272
It turns out I accidently put register globals "On" on my live server and that casuses the error. I switched it off again, which is better anyway, and the error is gone. I don't know if you could call this a bug. Anyway, here's the code (simplified readability) I'm using QuickForm 2.10. I
<html><body>
<?php
require_once('HTML/QuickForm.php');
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : 'default';
$form = new HTML_QuickForm('event', 'post');
$form->addElement('hidden','action','update');
$form->addElement('text','city','City',array("size"=>45,"maxlength"=>100));
$start['hour'] = &HTML_QuickForm::createElement('select','hours',null,array(1,2,3));
$start['min'] = &HTML_QuickForm::createElement('select','mins',null,array(4,5,6));
$form->addGroup($start, 'start', 'Starts', ' ');
$form->addElement('submit',null,'Submit',array("class"=>"submit"));
$form->addRule('city', 'City is required', 'required');
if ($action=='update') {
if ($form->validate()==true) {
$form->freeze();} } $form->display(); ?> </body></html> The validation method causes the error. - Jeroen