note 12616 deleted from function.setcookie by betz

From: Date: Thu, 06 Feb 2003 10:09:28 +0000
Subject: note 12616 deleted from function.setcookie by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43504@lists.php.net to get a copy of this message
This is a little comment for everyone out there that has had a problem with sending stuff to the browser before the setcookie and getting the lovly error message. <?php ob_start(); echo "The cookie monster watch me eat your cookie"; setcookie("chocolate_chip",1,time()+3600); ob_end_flush(); ?> ob_start will stop sending to the browser untill it gets the ob_end_flush() the good thing about this is it orders everthing right it will send you cookie first even if its not what you put first in the script. This also works for header enjoy

« previous php.notes (#43504) next »