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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.