I need to set a Cookie from a Login Page. I have tried the set_cookie function and on a test page, I have been able to set the cookie. On a more involved test page it isn't getting set. Not sure why. I have made sure of no white space, etc. Have looked for things that would cause output to the browser but I'm still stumped.
The process I'm using goes like this:
1. User comes to the Home page (actually could be any page on the site).
2. Session is Started.
3. Code runs to check for an existing Cookie. (in a separate functions php file)
4. If a Cookie is not found, I build one.
5. I set the cookie using "set_cookie".
I need to figure out why the cookie isn't getting set. I guess the first thing to find out is what I'm doing wrong as far as the order goes. I am asking for the following:
What order should things occur? (Session_start, then check for cookie, etc.) Oh, I tried moving the session start down passed the check cookie function, but this messed up since I need Session variables set to do some stuff.
I can provide code as needed if you need to see what's going on.