I am trying to make the user get redirected to the index.html page in case the $_SESSION['loggedin'] is already set. For some reason, it doesn't redirect the user, although the $_SESSION['loggedin'] when echoed returns a value.
if(!empty($_SESSION['loggedin'])) { header('Location: index.html');};
What am I doing wrong here?
header('Location: index.html');
sets an http header which needs to be set before any content is sent, i.e. before any echo. Also you should terminate your script after you set the location header.