PHP show/hide <div>
Posted: Sat Nov 06, 2010 6:13 pm
Hey guys, had a quick PHP question. I've been using a small PHP script to authenticate logged in users which redirects them to another page if they're not logged in. I'd like to change it so that instead of redirecting them to a different page, it hides a <div> element on my page, and shows another which pops up on top. I have my <div>'s, so all I need is to edit the PHP code now. Here is the code I currently have:
PHP at the top
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main.html");
}
?>
HTML
<div class="hsidebar1">
<div class="loginpanel">
Log in | Sign Up
</div>
<div class="loggedinpanel">
Logged In
</div>
<!-- End hSidebar1-->
</div>
CSS
.loginpanel {
visibility:hidden;
}
.loggedinpanel {
}
Basically I'd like the PHP to switch the visible <div> with the hidden one. If anyone has any ideas how to do this please let me know. I know how to show and hide <div>'s with javascript, but I'm not very experienced with PHP.
PHP at the top
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main.html");
}
?>
HTML
<div class="hsidebar1">
<div class="loginpanel">
Log in | Sign Up
</div>
<div class="loggedinpanel">
Logged In
</div>
<!-- End hSidebar1-->
</div>
CSS
.loginpanel {
visibility:hidden;
}
.loggedinpanel {
}
Basically I'd like the PHP to switch the visible <div> with the hidden one. If anyone has any ideas how to do this please let me know. I know how to show and hide <div>'s with javascript, but I'm not very experienced with PHP.