Warning: Undefined array key "count" in /home/eckfordd/public_html/citw185/examples/session_dae_page2.php on line 13

Don Alexander Eckford's SESSION Management Demo (Page 2)

Welcome back,
Warning: Undefined array key "username" in /home/eckfordd/public_html/citw185/examples/session_dae_page2.php on line 22

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/eckfordd/public_html/citw185/examples/session_dae_page2.php on line 22
!

You are continuing your session with ID: 375a14872378f07d2a2b06417b1cfd50

You have visited this page 1 times in total (counting both pages).

Go back to Page 1
Array
(
    [count] => 1
)
 

CODE FOLLOWS

<?php
// Resume the session
session_name("session_demo");
session_start();

include(
'includes/header.php');

// Set error reporting for development purposes
error_reporting(E_ALL);
ini_set('display_errors'1);

// Increment the session count variable again
$_SESSION['count']++;

// Display the session ID and variables
$session_id session_id();
?>

<!-- HTML Content -->
<h1>Don Alexander Eckford's SESSION Management Demo (Page 2)</h1>

<p>Welcome back, <?php echo htmlspecialchars($_SESSION['username']); ?>!</p>
<p>You are continuing your session with ID: <?php echo htmlspecialchars($session_id); ?></p>
<p>You have visited this page <?php echo $_SESSION['count']; ?> times in total (counting both pages).</p>

<!-- Link back to Page 1 -->
<a href="session_dae_page1.php">Go back to Page 1</a>

<!-- Optional: Display all session variables for debugging purposes -->
<?php
echo '<pre>';
print_r($_SESSION);
echo 
'</pre>';

include(
'includes/footer.php');
?>