0

Probably a bit of a dumb question but I just started learning php. I have to make some exercises and one of them is to make a php file that displays how often you have visited a page without closing your webbrowser (session variables). I managed to do quite so, but when I open the page I get the error: Notice: Undefined index: count in ... on line 5

PHP file:

<?php
  session_start();

  $_SESSION['count']++;  


  if($_SESSION['count'] == 0){
        echo "You have not visited this page earlier yet since you closed your webbrowser";
  } else { 
        echo "You have already visited this page " . $_SESSION['count'] . " times before you closed your webbrowser";
  }

?>
Niels
  • 9
  • 2
  • 8

0 Answers0