EDIT: thanks a lot for all your comments/replies. Even if i remove the JS, and use the PHP if/else statements only, i still get the same error.
i keep on running into the same error:
The 2 divs below are visible whereas only one of them should be shown at a time (whether or not the user is logged in).
For simplicity purposes, i removed the html inside the 2 divs.
<div id="header_wrapper">
<div id="loginbutton"></div>
<div id="menu">
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<?php
if (!isset($_SESSION['id']) || empty($_SESSION['id'])){ ?>
<script>
document.getElementById("menu").style.display = "none";
document.getElementById("loginbutton").style.display = "show";
</script>
<?php }
else { ?>
<script>
document.getElementById("loginbutton").style.display = "none";
document.getElementById("menu").style.display = "show";
</script>
<?php
}
?>
</div>
The $_SESSION['id'] is not empty. Indeed if i echo $_SESSION['id'] on the page, i get the correct session #.
Am I missing something?
else, useif (isset($_SESSION['id']))and btw, it should be...dislpay = "visible";<script>to<script type="text/javascript"><?to<?phpwhat happens?