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?

Member Avatar for diafol

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');
}
...
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.