Php为什么php中没有排除功能?

i am creating a login script with php and mysql. My problem is that when i am logged in my loginForm is still visable... So i thought that it would be great with an opposite "exclude" from include, but i found it this wasn't possible and my question is why is that? I guess i can remove the loginForm with css by display none. Is there any easier way to do it? Thanks for any help, downvote if it's a stupid question, cheers!

Here is some code to clear things up

<form action = "login.php" method = "post" class = "possi">
<input type = "email" placeholder = "Email" name = "email" class = "formControl2"><br>
<input type = "password" placeholder = "Password" name = "password" class = "formControl2"><br>
<input type = "submit" value = "login" id = "knapp2"></form>

Php

<?php
include ("loginForm.php");
?>


if($_SESSION['loggedIn']==true)
{
include("newCarForm.php");
include ("logoutForm.php");
// exclude ("loginForm.php");
}

You can't exclude, because the include happened before. The code is already executed at the time, you want to exclude it.

Best way to solve this issue is include conditionally:

if (!$loggedin) {
  include "loginForm.php";
}

Actually, you should do like this

1)Have some loginForm route like http://localhost:5000/login submit it for processing.

2) In that file set up the session and redirect to another route which will show you the newCartForm and logoutForm.

It is bad practice to show a form on the basis of one true or false condition.