Hi,
I am working a my way through a tutorial and can't quite figure this out myself...
Code:
<?php
// initialize a session
session_start();
// increment a session counter
$_SESSION['counter']++;
// print value
echo "You have viewed this page " . $_SESSION['counter'] . " times";
?>
Error:
Notice: Undefined index: counter in C:\Program Files\EasyPHP 2.0b1\www\index.php on line 8
You have viewed this page 1 times
Notice I get the error, but it ALSO gives me the result. If I refresh the page or revisit it I get the result (incremented by 1) and NO ERROR MESSAGE.
I'm kind of thinking it is my error setting in PHP.INI but would like to see if there is another way around it.
Any help, would....help! 🙂
Thank you