To prevent further hair loss, realize that this is true for ALL variables declared
outside the function, including form variables and session variables. Either pass
them as parameters or use the 'global' declaration in the function, as Don did.
Don Read wrote:
> On 17-Apr-01 Pat Hanna wrote:
> > I found out today after suffering from minor headaches and hair loss that if
> > you have functions defined in and outside file name 'foo.php', and in those
> > functions you use cookies, you must pass those cookies to the function
> > called. I tried using a value from a cookie in a function and it never could
> > access it unless I passed it. Funny
>
> function my_func() {
> global $cookie; // ?
>
> if ($cookie == "thin mint")
> call_girl_scout();
> }
>
> BTW, sometimes the hair does grow back.
>
> --
> Don Read [EMAIL PROTECTED]
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]