variable scope

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaco
Forum Newbie
Posts: 13
Joined: Mon Jun 29, 2009 6:40 pm

variable scope

Post by jaco »

Hello everyone, general question. I have read that user specified server vars. data is lost when the browser goes to another page and the way to avoid that is to use sessions.

Is that true? If the user is using the back or forward button on his browser, the web page is retrieved from cache, aren't these values also stored it the cache?

Cheers,

Jacques
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Re: variable scope

Post by BornForCode »

The values manually inserted by the user won't populate the form for example, that's why the best solution (in case of forward/back actions) is to use session. It is not recommended in development to put accent on what user has in his cache since he can easily edit/manipulate the cache in a malicious scope.

I am also sure that the title of the post is not properly chosen, variable scopes refers to something else. http://www.php.net/manual/en/language.v ... .scope.php
Post Reply