Hi Everyone,
Can someone explain to me where I got wrong with my code. I'm trying to pass a session variable from page to page, from the first to second page the value is still there but on the succeeding page the value is gone. I have ensure that the session_start is always at the top of the page that's calling the session variable. The code goes like this
public function register($post) {
$username = $post['username'];
$password = $post['password'];
$user = $this->authenticate($username, $password);
if(count($user)):
$_SESSION['userid'] = $user['userid'];
$_SESSION['username'] = $user['username'];
$_SESSION['password'] = $user['password'];
endif;
return $user;
On the succeeding page, I call the
$sessionID=$_SESSION['userid'];
echo $sessionID;
and it throws me the value but on the next page when I call it again like the same way as I call it above it returns no value.
Thanks in advance for helping!