PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
It creates a cookie called Projects which expires in 100 days containing a timestamp.
I want to update the cookie after certain transactions so I just use the same line but it's not updating my cookie, however if I refresh the page it does update my cookie!
Can any of you tell me if:
a) My code is correct or
b) Why it's only updating the cookie after a 2nd go (after a browser refresh)
you use the page again if you set this cookie in this page?
that's wrong.
you can use it so:
1. Check the cookie if it's already set or not.
2.a) If not: set this cookie.
2.b) If it's set. Don't take any action about this cookie and load the page.
Have a nice day.
No idea to solve your problem, but interesting subject (sorry, cant test either, hardware fubared).
Does the header() break it if you add a sleep() or usleep() before it?
I have a wierd thought that the header is to fast for the setcookie. Unlikely, but...
Are you on IIS? The setcookie() then header() thing doesn't work correctly on that IIRC - always had to fix a couple of lines in phpMyAdmin to account for the bug.