joeisbatman
Programmer
The php manual has conflicting data on this issue, and I keep hearing different things from everyone.
I have one variable that I need to be constantly updated. Using session variables how can I keep this variable updated? I find that a if I do-
session_start();
$foo =5;
session_register('foo);
------------------------
Then on another page
------------------------
session_start();
$foo = $foo + 5;
echo $foo;
The result is 10. If I keep hitting refresh on this page the number will continue to go up. HOwever once i leave this page, the # returns to 5. Let me quote a post in the PHP docs:
====================================================
Re: changing registered variables.
registered session vars cannot be changed by the user. I.e. typing in
will not cause the "$valid_user" var, which we have previously
registered,
to be overwritten with the value "true".
You can change the value of registered vars in your script. I.e. coding
if ($thisguyisvalid) {
$valid_user = 'true';
}
will work. The $valid_user var will continue to be set at true for the
session, or until you explicitly change it again.
=========================================================
So can anyone clear this up?
I have one variable that I need to be constantly updated. Using session variables how can I keep this variable updated? I find that a if I do-
session_start();
$foo =5;
session_register('foo);
------------------------
Then on another page
------------------------
session_start();
$foo = $foo + 5;
echo $foo;
The result is 10. If I keep hitting refresh on this page the number will continue to go up. HOwever once i leave this page, the # returns to 5. Let me quote a post in the PHP docs:
====================================================
Re: changing registered variables.
registered session vars cannot be changed by the user. I.e. typing in
will not cause the "$valid_user" var, which we have previously
registered,
to be overwritten with the value "true".
You can change the value of registered vars in your script. I.e. coding
if ($thisguyisvalid) {
$valid_user = 'true';
}
will work. The $valid_user var will continue to be set at true for the
session, or until you explicitly change it again.
=========================================================
So can anyone clear this up?