The problem: This cookie will not set. . .
My site has a login file which passes the form information to a PHP processing file. The processing file validates the information, is supposed to set cookies and then redirect the user to a "thank you" page. The code is as follows:
/ Prior to the following code, take the user information and enter it into a login database table /
setcookie ('user_id', $user_id, 0, '/', 'www.my-site.com', 0);
setcookie ('user_name', $name, 0, '/', 'www.my-site.com', 0);
header ('Location: http://www.my-site.com/login/newthank_you_login.php');
exit();
I have verified the following:
The contents of $user_id exist; meaning, $user_id is not NULL
The contents of $name exist; meaning, $name is not NULL
No headers have been sent prior to setting the cookie
Changing the header('Location: http://www. . .') to a link (<a href='www. . .') does not change the result -- the cookies are still empty.
What is doubly confusing is this EXACT same file, but using a different CSS page works! All I did was duplicate the file, give it a new filename, and linked it to a new CSS page to test some design changes. The old file works, the new duplicate file does not.
Any ideas why these cookies won't set?