Inheritance of JS/css

            echo '<div id="content"';

You seem to have forgotten the > on this tag. The browser will probably auto-recover from this, but its a note.

This line in the menu bit is superfluous:
if (isset($_SESSION["logged_in"]) and $_SESSION['logged_in']==TRUE) {

You already do that check further up the page, and if it was false, sent a header redirecting the user, so it would never get to this line if this were not true.

Your script tries to define elSidebar before the code that puts the sidebar into the DOM. That wont work. (Remember, I said order matters…)

    <script src="js/togglemenu.js" </script> <--tries to define elSidebar.
    <?php
// menu
if (isset($_SESSION["logged_in"]) and $_SESSION['logged_in']==TRUE) {
    echo '<div id="sidebar" class="hidden">'; <--div with id "sidebar" does not exist until this point.
1 Like