Hi,
another newbie here and 1st-time post so hope I have posted this correctly and I hope someone can help because it is doing my head in...
Basically I have a cookie that gets set after a user submits an answer to a poll question. When the user hits the back button and tries to resubmit they can't because the cookie is recognised. Which is fine.
The problem is when the user refreshes their browser or restarts their browser the cookie is not recognised (or must be cleared).
I think it's because it is only getting set after the submit button is hit but how do I keep the cookie set every time after that within the user's browser??
if it helps here's the code I've got above my opening html tag:
setCookie("mypoll", $_POST['qid'], time() + 2592000);
if (isset($HTTP_COOKIE_VARS) && !empty($HTTP_COOKIE_VARS)) {
if ($HTTP_COOKIE_VARS['mypoll'] && $HTTP_COOKIE_VARS['mypoll'] == $_POST['qid']) {
$voted = "blah";
}
else {
$voted = "";
}
}
Any help or advice here would be much appreciated!!!
Regards,
Persist01.