Notice: Undefined index: logged
This is bizarre and I cant figure it out as I have used the session logged = true/false twice throughout my website and it works flawlessly.
I have tried using isset which just returns a blank screen
<?php
if($_SESSION['logged']==true)
{
echo '<div class="container">
Logged in!
</div>';
}
elseif($_SESSION['logged']==false)
{
echo '<div class="container">
You must be logged in to use the events service
</div>';
}
?>
The session is set from another file.
if($count==1)
{
$_SESSION['logged']=true;
$_SESSION['username']=$myusername;
header("Location: ../index.php");
exit();
}
else
{
$_SESSION['logged']=false;
header("Location: loginError");
exit();
}
The thing I cannot figure out is why the error message is displaying when i'm using it this time and not the other 2 times? as the if and else statement is actually working fine if you ignore the error message!
The previous 2 times I use this session logged I also have no error messages displayed and it works fine.