problem creating cookies - "Cannot add header .."

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!

Moderator: General Moderators

Post Reply
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

problem creating cookies - "Cannot add header .."

Post by eyal »

Hi,

When I'm trying to use a cookie I'm getting the following error:

Code: Select all

Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\direct_site\try3\between1to2.php:3) in c:\apache\htdocs\direct_site\try3\between1to2.php on line 44
I'm runing the PHP pages on my Computer using Apache server installed by PHPTriad.

When I'm runing blank page with nothing but this line everything works well. I wrote the follwing line:

Code: Select all

setcookie("sdfds", "blabla", time()+3600);
Thanks!
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

Post by eyal »

Thanks!
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

:wink:
Post Reply