FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » setcookie() returns FALSE
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: setcookie() returns FALSE [message #179700 is a reply to message #179698] Fri, 23 November 2012 09:52 Go to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 23.11.2012 07:26, schrieb cerr:
> Hi,
>
> I have the following code:
> if(setcookie("FSBO", "TEST", time()+3600)) {
> echo "TRUE<br>";
> } else {
> echo "FALSE<br>";
> }
> print_r($_COOKIE);
> and the ouput on my box is false. How do I know why I can't set a cookie?

The problem is that cookies are set in the HTTP header, which are sent as soon as
there is output. If you had turned all messages on you would see an error message
telling you '...headers sent...'

see http://www.php.net/manual/en/function.headers-sent.php and the links there.

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: PHP 5.5 and Windows XP
Next Topic: Tokenize an HTML page.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 14:12:57 GMT 2024

Total time taken to generate the page: 0.04306 seconds