Setting a global

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

Bruce

mcronline
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

http://www.w3schools.com/php/php_sessions.asp

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
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: http://us1.php.net/manual/en/function.session-start.php


Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest