Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Setting a global

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
bruceaj
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Sep 07, 2011 5:13 pm

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
mcronline
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Jan 24, 2014 3:59 am

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
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.