AW: [PHP-WIN] Need help with HTML form errors

From: Date: Mon, 05 Jul 2010 08:42:32 +0000
Subject: AW: [PHP-WIN] Need help with HTML form errors
References: 1 2 3 4 5  Groups: php.windows 
Request: Send a blank email to php-windows+get-30215@lists.php.net to get a copy of this message
Hi Nagendra, Nagendra wrote: > So, What if I define the same global variable twice, will this solve the > issue? No, this will most likely overwrite the values from the variables defined outside of the routine. I'll try to illustrate this a bit. [CODE] <?php // WON'T WORK // variables defined and set outside of the function $filter = "123"; $filterfield = "ID"; function form_fill () { // both variables will be reinitialized with false and the values from the outside scope will be discarded $filter; $filterfield; } [/CODE] [CODE] <?php // WILL WORK // variables defined and set outside of the function $filter = "123"; $filterfield = "ID"; function form_fill () { // both variables are declared as being defined outside of the function (global scope) global $filter, $filterfield; } [/CODE] Did you do it like in the above example 2? Regards, Sascha

« previous php.windows (#30215) next »