Hi, i'm building a login script for my site using Sessions and Cookies to keep the user logged in. The problem itself is, session_id() returns an empty value after i start the session and the user tries to follow some link.
I actually read the php sessions documentation but i think i'm missing something.
Tried this and it reproduces the behaviour of my login code:
Page1.php
<?php
session_start();
echo 'Session ID is '.session_id().'<br>';
echo '<a href="Page2.php">Go to Page 2</a>';
?>
Page2.php
<?php
if (session_id()=''){
echo 'Session ID is empy??';
}else{
echo session_id();
session_start();
}
?>
When i Reach page1 i get the
So when i click Page2 link, i always get an empty session id. Is this normal behaviuor?
I thought session_id kept its value, im not using sessions in URLs options are set to cookies, also checked the gc_max... and are all set so it doesnt timeout
Im using XAMPP to develop, and since i thought it may be a xampp issue, i switched to my Apache + PHP server and the behaviour is the same... Tested on Opera and Internet explorer
Any help, comment is welcome. Thanks.