Setting a global

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

Setting a global

Postby bruceaj » 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..


New php-forum User
New php-forum User
Posts: 2
Joined: Fri Jan 24, 2014 3:59 am

Re: Setting a global

Postby mcronline » Fri Jan 24, 2014 4:02 am

You could use Session Variables

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

Re: Setting a global

Postby seandisanti » 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:

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests