error:Notice: Undefined index: username in C:\xampp\htdocs\E_COMMERCE\INCLUDE\header.php on line 20
login in information:
so i have a checkbox called "$remember_p". if check box is on than i want to set cookies but if its not on than i want to set session.
if($remember_p == "on")
{
//cookies doesnt get destory when window is close
setcookie("id", $id, time()+172800);
setcookie("username", $username_p, time()+172800); //seconds - 2 days
header("location: index.php");
}
else if($remember_p == "")
{
//ession is destory if window is close
$_SESSION["id"] = $id;
$_SESSION["username"] = $username_p;
header("location: index.php");
}
than in different file iam check if user in loged in or not:
in this line i get the error.
if((isset($_SESSION['username'])) || (isset($_COOKIE['username']))) /*** user is loged in ***/
if user login with seesion than it work fine. but when user is log in by cookies than i get the error.