Notice: Undefined variable: _SESSION in C:\xampp\htdocs\dl\index.php on line 117

here;s the code:

<?php
                    if ($_SESSION['username'])
                    echo "Hello ".$_SESSION['username']." ♔<a href='logout.php'> Logout </a> ";
            ?>

Add isset for session.

   if (isset($_SESSION['username']))
            echo "Hello ".$_SESSION['username']." ♔<a href='logout.php'> Logout </a> ";
Be a part of the DaniWeb community

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