need some advice on my session variable, it is found as registered using the isset function however, when i try to call it out on another page it is gone, the following are the codes used to test the session viariable. Cookies have been enabled by the way.
1st page
<?php
session_start();
$HTTP_SESSION_VARS['sess_var'] = "Hello world!";
echo 'The content of $HTTP_SESSION_VARS[''sess_var''] is '
.$HTTP_SESSION_VARS['sess_var'].'<br />';
?>
<a href="page2.php">Next page</a>
2nd page
<?php
session_start();
echo 'The content of $HTTP_SESSION_VARS[''sess_var''] is '
.$HTTP_SESSION_VARS['sess_var'].'<br />';
unset($HTTP_SESSION_VARS['sess_var']);
?>
<a href="page3.php">Next page</a>
your help is appreciated.
session variable cannot exist betwen pages.
Moderator: General Moderators
Try a simple test first, like
This should increment the counter everytime you reload the page. Note how i used $_SESSION, not $HTTP_SESSION_VARS ( i presume you are using PHP => 4.1.0
)
If this works then the problems in your code, if it doesn't then you have general session problems.
Code: Select all
<?php
session_start();
if(empty($_SESSION['count'])){
$_SESSION['count'] = 1;
} else {
++$_SESSION['count'];
}
echo 'Count is : '.$_SESSION['count'];
?>If this works then the problems in your code, if it doesn't then you have general session problems.
session variable cannot exist betwen pages.
yeah, the count is always 1 .... what could be the problem huh???
my session.auto_start is set to 1
though not using session_register function, i also turn on the register global feature...
what's missing..?
please help.
my session.auto_start is set to 1
though not using session_register function, i also turn on the register global feature...
what's missing..?
please help.
session variable cannot exist betwen pages.
session.save_path = /tmp what should be the value..? I'm using Windows XP.. with apache server.
are we getting closer to the main problem?
are we getting closer to the main problem?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK