Good morning guys, I have set this code and i would like to unset $_SESSION["username"], IF $_POST["logout"] isset
<?php
if (isset($_POST["name"]) && isset($_POST["password"]))
$_SESSION["username"]=$_POST["name"];
unset($_SESSION["username"]);
if(isset($_POST["logout"]))
unset($_SESSION["username"]);
?>
It seem some bad logic in code, try
if (isset($_POST["name"]) && isset($_POST["password"])) {
$_SESSION["username"]=$_POST["name"];
}
if(isset($_POST["logout"])) {
unset($_SESSION["username"]);
}