-2

Ok guys when I try to run my simple php code I get this error: Notice: Undefined index: Status, here is my code:

<?php 
    session_start();
?>
<!DOCTYPE HTML>
<html>
    <head>
        --->All links
    </head>
    <body>
        <?php 
            if($_SESSION['Status']=='1'){
        ?> 
            ...--->NAV1

        ?>  
            <?php
            }else{
        ?>
          ...NAV2--->
        <?php 
            }
        ?>
        </nav>
    </body>

The error is on " if($_SESSION['Status']=='1'){", this code will check if user is logged or not then shows a proper navbar.

1 Answers1

-1

Update your line.

if($_SESSION['Status']=='1'){

to

if(isset($_SESSION['Status']) 
&& !empty($_SESSION['Status']) 
&& $_SESSION['Status']=='1'){
Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30