0

I've realised a "remember me function" using $_COOKIE and on my LAMP machine where I develop it works fine.

But then I've uploaded the code to the remote server and it gives me this error

Warning:  Cannot modify header information - headers already sent

when executing

setcookie('_temp',$val, time()+$cookie_time);

I don't get why it's working on my machine, but not on the remote server...

Thank's!

PS I've doublechecked and all the code seems the same...

don
  • 4,113
  • 13
  • 45
  • 70

1 Answers1

0

Cookies are set via HTTP headers, so the setcookie() has to happen before sending the headers (which means before any output). The Warning you get should tell you the exact line where the output started.