I am designing a website that will have users. Depending on the SESSION, homepage will either show “Log in” or “Log out” buttons. I try to do it with following code:
<?php
session_start();
if(isset($_SESSION['user'])) {
?>
<style>
#login {display: none;}
#logout {display: block;}
</style>
<?
} else {
?>
<style>
#logout {display: none;}
#login {display: block;}
</style>
<?
}
?>
Everything works perfect in all browsers except IE9; in IE layout messes up, images don’t show up, their sizes change, etc. What other code can I use? I can use any suggestions, maybe even javascript.
Thanks in advance.
Thanks to comments above I solved the problem by copying the above code (except
session_start()) inside the ‘html’ tags (specifically inside the ‘body’ tags). Previously that code was at the beginning of the file, outside the ‘html’ tags.