What is the best way to display a new navigation field after a user logs in using PHP?

After a user logs in, you can display a new navigation field by checking if the user is logged in and then showing the new navigation field accordingly. One way to achieve this is by using PHP session variables to keep track of the user's login status. Once the user successfully logs in, you can set a session variable to indicate that the user is logged in, and then use this variable to display the new navigation field.

<?php
session_start();

// Check if user is logged in
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true) {
    // Display new navigation field
    echo '<a href="new_page.php">New Page</a>';
} else {
    // Display regular navigation field
    echo '<a href="home.php">Home</a>';
}
?>