0

Hello,

I'm using php to write my code and I have an if else statement. If the user is logged in, show the content. If the user is not logged in, show a login form where the user has to input username/password.

So how do I correct my layout where if the login form pops up, it will be where the content should be if logged in. Currently my form will be to the right of the content (which is invisible right now because it user not logged in). I'm not sure which forum section this should belong in, but maybe I need to seek help on how to make my form overlap these invisible contents?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by diafol
0

Perhaps the best place would be the php forum. Anyway, it should be straightforward. I'm assuming you're using sessions for login.

if(isset($_SESSION['login'])){
  include('content/whatever.php'); //you can do this or place the content into a variable and echo that or place raw html/php see code box below ->
}else{
  include('includes/login.php');
}
<?php
...
if(isset($_SESSION['login'])){
?>
<p>How's that for a change from the old login form?</p>

<?php
}else{
  include('includes/login.php');
}
...
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.