What is the main issue with the Counter Script mentioned in the forum thread?

The main issue with the Counter Script mentioned in the forum thread is that the counter value is not being stored persistently across page loads. To solve this issue, we can store the counter value in a session variable so that it remains consistent throughout the user's session.

<?php
session_start();

if(isset($_SESSION['counter'])) {
    $_SESSION['counter']++;
} else {
    $_SESSION['counter'] = 1;
}

echo "You have visited this page " . $_SESSION['counter'] . " times.";

?>