Re: global vars

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

 



When you redirect, you lose your variables. This means that you must
send them in some form to the other script. If you change your redirect
command to the following, you will see that $a gets transferred and
echoed in the second script as well as the first:

Header("Location: second.php?a=$a");

Note: this only works if you have "register globals" on which you seem
to have, so it should fix your problem.

Good luck!

--Dave


On Wed, 2002-10-30 at 23:05, Tomas Kubis wrote:
> Hello,
>  I have big problem. I upgraded PHP from 4.1.2 to 4.2.3 and my scripts with
> doesn´t work. Please help me!
> in php.info register globals=On
> 
> For example I have one script:
> first.php
> <?
> global $a;
> $a=150;
> Header("Location: second.php");
> ?>
> 
> second.php
> 
> <?
> echo $a;
> echo $GLOBALS['a'];
> echo "END";
> ?>
> 
> Where I have a bug?
> 
> Thank you very much
> 
> Tomas Kubis
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux