homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

[PHP] Not global variables?

 10:21 am on Mar 15, 2002 (gmt 0)


I'm chaning in my script so I turn of the global variables in my php.ini (module version).

I know how to get variables from get ($_GET), and post ($_POST) but what about the session variables? I have registered them through the 'session_register' function.

How do I get those without the help of global variables?

/Grodan :)



 11:21 am on Mar 15, 2002 (gmt 0)


Are you using session_start() ?

It needs to be called before "<html>" appears in your code. In the header section - as a rule where I use this I make it the first statement in my code. After that is used every variable that you set using session_register('var_name'); is available via $var_name.



 11:24 am on Mar 15, 2002 (gmt 0)

Caveat: Use with caution if doing something where SEO is important. If cookies are not available then php postfixes all (local?) links with ?PHP_SESSION_ID=SDF2332fdfsD23423d etc.

This is what happens when the bots visit your page.


 11:54 am on Mar 15, 2002 (gmt 0)

Hi again gethan :)

I am using session_start.

To get my sessions variables today I am just calling for $'var_name', what I am wonering is if I can use the same method it when I turn my global variables off in php.ini?



 12:03 pm on Mar 15, 2002 (gmt 0)

Not something I've done before. I think you'll just have to try it out and see the results... you can always turn it back on again. Let me know :)


 2:34 pm on Mar 15, 2002 (gmt 0)

Hi Grodan,

Looking at my PHP4 book. It says to think of a registered variable as a super global declaration. Also since your variable values are stored on the server by session ID I would think you could turn globals of in your ini file.

Caution: This is my best guess. I have never tried it.

Lets us know how it goes.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved