hi
I am trying to execute this code but this is not functioning. This always return 0. I dont want to use session_register().
<?php
if (isset($HTTP_SESSION_VARS['count'])) {
$HTTP_SESSION_VARS['count']++;
}
else {
$HTTP_SESSION_VARS['count'] = 0;
}
?>
Thanks
Jai
session handling
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You really should have added this to the bottom of your previous post - there is no need to start a new topic.
In order to use sessions you must have session_start() at the top of any scripts that set session variables or try to use them.
Mac
In order to use sessions you must have session_start() at the top of any scripts that set session variables or try to use them.
Mac
but now it's me who is having a question...
I'm registering on my first page session variables:
$_SESSION["strTest"] = "hello";
This works, but when I try to access the variables on the next page, it doesn't, though I have put
session_start();
on top of the code. I can register new variables, but
$_SESSION["strTest"]
is not known.
What can be wrong? Is there something missing? I checked several examples, but it seems to be the same - only one difference: the others work...
$_SESSION["strTest"] = "hello";
This works, but when I try to access the variables on the next page, it doesn't, though I have put
session_start();
on top of the code. I can register new variables, but
$_SESSION["strTest"]
is not known.
What can be wrong? Is there something missing? I checked several examples, but it seems to be the same - only one difference: the others work...
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
4.1.2
hi,
I#m working with PHP 4.1.2 .. so this shouldn't be the problem... The registration works, but there's nothing left on the next page. I've got that feeling that there's something missing on this next page, but can't say what, session_start(); ist placed right on top...
(By the way, I tested with $HTTP_SERVER_VARS, it doesnt work, too.)
I#m working with PHP 4.1.2 .. so this shouldn't be the problem... The registration works, but there's nothing left on the next page. I've got that feeling that there's something missing on this next page, but can't say what, session_start(); ist placed right on top...
(By the way, I tested with $HTTP_SERVER_VARS, it doesnt work, too.)