PDA

View Full Version : php - setcookie



jetalomar
March 30th, 2004, 23:31
I'm getting an error when I try to set the cookie. For some reason I get this error when I try to set the cookies.
Warning: Cannot modify header information - headers already sent by (output started at /home/mvplea/public_html/index.php:1) in /home/mvplea/public_html/index.php on line 32

and the php code is
if($setuser=="true"){
setcookie("user", $username, time()+(8640000*7),"/"); //will expire in a week
}

nickc
June 7th, 2004, 10:51
Try using:-

ob_start();

at the begiinig of your code.

Nick