So I am developing a login system for my website and I would like to change the navigation bar when the user is logged but I can't get it to work because the session keeps getting lost after I refresh the page to update the navigation bar. This is what I got in my login.php script:
if ($loginNumRows == 1) {
echo 'true';
session_start();
$_SESSION['username'] = $loginRow['name'];
When this echoes 'true', the following javascript is loaded:
if (html == 'true') {
window.location.href = "index.php";
I tried with "location.reload(true);" and it is still the same. And in the main page, where the navigation bar is, I make the following check:
<?php if (isset($_SESSION))
{...}
However this always returns false. Any ideas what to do? Thanks!