AW: Need help with HTML form errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux