I am a newbie in PHP programming. I am creating a simple login form with sessions. I am passing two session variables : $_SESSION['username']
and $_SESSION['logon']
. Here is my code:
$rowcount = mysqli_num_rows($result);
if($rowcount == 1){
session_start();
$_SESSION['logon'] == "online";
$_SESSION['username'] = $username;
header("location:../index.php?username=$_SESSION[username]");
}
The problem is that when I try to access the $_SESSION['username']
variable, it gives me the appropriate value stored in it, but when I try to access the $_SESSION['logon']
variable, it gives me an undefined offset error.