Re: global $form not working on php5

From: Date: Tue, 31 Jan 2006 01:43:54 +0000
Subject: Re: global $form not working on php5
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22736@lists.php.net to get a copy of this message
On 1/30/06, Nicolas de Bari Embriz Garcia Rojas <nbari@ejemplo.org> wrote: > Hi am migrating to a php5 server but all my code that uses > html_quickform is not working > > the code has some registerRules like: > > $form->registerRule('check_login','function','checkNewLogin'); > > and the checkNewLogin function has something like this: > > function checkNewLogin($signup) { > global $form; > print_r($form); > $signup->setLogin($form->getElementValue('login')); > $signup->setEmail($form->getElementValue('email')); > return $signup->checklogin(); > } > > > i have put a print_r($form) and notice that the var is empty but this > only happends on php5, any idea on how to keep using form, or > getElementValues on php5? > Try using $_GLOBALS instead of the global keyword. You'll have much fewer issues IMHO. Of course the real solution is to write your code properly so that it doesn't rely on globals. -- Justin Patrin

« previous php.pear.general (#22736) next »