I have the following setup:
- index.php
- subpage.php
When visiting either pages I have a "header intro animation". I only want the user to see this animation upon first page visit and not repeat it when refreshing/visiting other subpages within the same session.
I've tried doing the following:
$disableAnimationOnOtherPages;
if(session_id() === '')
{
// session has NOT been started
session_start();
echo "SESSION WAS NOT SET";
}
else
{
// session has been started
echo "SESSION HAS BEEN SET";
$disableAnimationOnOtherPages = true;
}
So when I visit any page the first time I set/start the session and then if I refresh or go to a subpage, then $disableAnimationOnOtherPages = true;
will be set, so that I can use it as a reference to disable my javascript animation in my included .js file further down.
But regardless of what I do, im only getting "SESSION WAS NOT STARTED".
Any ideas on what im doing wrong in this context?