Setting a global

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Sep 07, 2011 5:13 pm

Wed Jan 22, 2014 5:13 pm

I want to set a global that each of my webpages can read (see?) as long as my browser is open. I've tried the $_GET('gvar') and setcookie('gver', 'myvar', 0). Using setcookie seemed "hokie" but I tried it anyhow. Neither worked.

If either of these show have worked, then I must have a programing problem of my own. Or, is there some other way.

Thanks for help..


php-forum Fan User
php-forum Fan User
Posts: 974
Joined: Mon Oct 01, 2012 12:32 pm

Sat Feb 01, 2014 11:09 pm

There are lots of ways to accomplish what you're trying to do, but probably the best is to use session variables. Start here and follow the examples:

Post Reply