I am using setcookie in a self-submitting form. Once the form is submitted, it sends an email and then it redirects to the next page by using a header. The problem is that the cookies aren't set for the email even though they are set (and displayed) on the next page. I've tried using the following code to reload the page before I send the email but to no avail:
setcookie("survey_username", $_POST['yourname'], time() + 31536000, '/survey/', $_SERVER['SERVER_NAME'], 0);
header("Location: ". $_SERVER['PHP_SELF']);
exit;
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









