Hi all,
I am building a little pop up that appears on the front page of a website for a quick survery.
Got it all working fine, but what I want to do is only show that pop up to the current visitor once, so when they come back to the home it doesnt pop up again.
Here is my code that I’m guessing will go in a if statement looking for a session, but not 100% on it:
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<div style="position:relative; width:100%; height:100%;">
<div style="position:absolute; float:left; top:95px;"><a href="#" onclick="popup('popUpDiv')" style="position:absolute; color:#FFFFFF; font-size:22px;">No</a></div>
<div style="position:absolute; float:left; left:127px; top:95px;"><a href="http://www.surveymonkey.com/s/STZCWNM" target="_blank" style="position:absolute; color:#FFFFFF; font-size:22px;" onclick="popup('popUpDiv')">Yes</a></div>
</div>
I’m thinking of something along this sort of line, but doesnt seem to work:
session_start();
if( $_SESSION['visited'] ){ ?>
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<div style="position:relative; width:100%; height:100%;">
<div style="position:absolute; float:left; top:95px;"><a href="#" onclick="popup('popUpDiv')" style="position:absolute; color:#FFFFFF; font-size:22px;">No</a></div>
<div style="position:absolute; float:left; left:127px; top:95px;"><a href="http://www.surveymonkey.com/s/STZCWNM" target="_blank" style="position:absolute; color:#FFFFFF; font-size:22px;" onclick="popup('popUpDiv')">Yes</a></div>
</div>
<? } else $_SESSION['visited'] = true; { ?>
<? } ?>