How to set cookies via PHP in the middle of a document?
        Posted  
        
            by Sam
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sam
        
        
        
        Published on 2010-06-10T07:26:28Z
        Indexed on 
            2010/06/10
            7:32 UTC
        
        
        Read the original article
        Hit count: 267
        
Hi all, how can I set cookies in the middle of a document, without incurring a 'headers already sent' error? What I'm trying to do is make a log out script (the log in cookie setting works...so odd. Is it because it's enclosed in an if statement?) however I've already echoed the page title and some other stuff at the top of the page, before I've made this logout happen.
Thanks!
© Stack Overflow or respective owner