Forum Moderators: coopster

Message Too Old, No Replies

setcookie

         

xbl01234

12:29 am on Mar 24, 2008 (gmt 0)

10+ Year Member



hi:
why the setcookie() function must appear BEFORE the <html> tag?

thanks

eelixduppy

12:49 am on Mar 24, 2008 (gmt 0)



Because it sends data with the headers which needs to be sent to the browser before any output to the browser, including HTML.

g1smd

1:13 am on Mar 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's a bit like email, where the TO and FROM data must appear in the header that is sent out before the message itself is sent.

There's also a header ABOVE the HTML page, one that you normally don't see in a browser.
Use the Live HTTP Headers extension for Mozilla Firefox and Mozilla Seamonkey to investigate it.

xbl01234

7:41 am on Mar 24, 2008 (gmt 0)

10+ Year Member



thanks a lot