Re: Warning: Cannot add header information - headers already sent
From: Jedi121 (jedi121news_at_free.fr.Removethis)
Date: 03/08/04
- Next message: IanW: "Re: php newbie"
- Previous message: Jedi121: "Re: PHP compiler"
- In reply to: Phyzlo: "Warning: Cannot add header information - headers already sent"
- Next in thread: Phyzlo: "Re: Warning: Cannot add header information - headers already sent"
- Reply: Phyzlo: "Re: Warning: Cannot add header information - headers already sent"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 08 Mar 2004 20:27:40 +0100
Phyzlo a écrit le 08/03/2004 :
> Hello,
Hi
> I've recently started learning PHP and have a question.
> I tried running below script which can be found at
> http://se2.php.net/manual/sv/function.setcookie.php
>
> but I keep getting this message on my browser, why?
Because you didn't read the doc about Cookies.
http://www.php.net/setcookie
You must NOT output anything before using setcookie()
You MUST reload the page to see the cookie set.
> -----
>
> <?
> echo "Setting cookie";
Delete this line and it'll run.
>
> $value = 'Test value';
>
> setcookie("TestCookie", $value);
> setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
> setcookie("TestCookie", $value, time()+3600, "/~rasmus/",
> ".example.com", 1);
>
> echo "Cookie Set!";
> ?>
- Next message: IanW: "Re: php newbie"
- Previous message: Jedi121: "Re: PHP compiler"
- In reply to: Phyzlo: "Warning: Cannot add header information - headers already sent"
- Next in thread: Phyzlo: "Re: Warning: Cannot add header information - headers already sent"
- Reply: Phyzlo: "Re: Warning: Cannot add header information - headers already sent"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]