I needed to have a counter on my page that would increment each time the website is visited, pretty simple huh, but...
I have run into a problem, for some reason my page counter doesn't increment at all even though the code seems to be correct.
<?php
if (!isset($_COOKIE["visitCount"])) {
setcookie("visitCount", 1);
} else {
$_COOKIE["visitCount"]++;
}
echo $_COOKIE["visitCount"];
It always stays at 2, no matter how many times i refresh the page, help would be greatly appreciated.