Re: Help! Can't set cookie or redirect!!!

From: Date: Sun, 29 Sep 2002 01:55:46 +0000
Subject: Re: Help! Can't set cookie or redirect!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118031@lists.php.net to get a copy of this message
Never mind, I found it.. *sigh* I forgot about phpinfo().. Everything works now, cookies, redirection, everything.. thanx! Phil ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'Phil Powell'" <soazine@erols.com>; <php-general@lists.php.net>; <talk@nyphp.org> Sent: Saturday, September 28, 2002 9:09 PM Subject: RE: [PHP] Help! Can't set cookie or redirect!!! > You can only set a cookie before any output is send to the browser. A > newline, space, or <html>, etc, is output to the browser. Redesign your > code so the cookie is set before any output or use output buffering. > > ---John Holmes... > > > -----Original Message----- > > From: Phil Powell [mailto:soazine@erols.com] > > Sent: Saturday, September 28, 2002 9:03 PM > > To: php-general@lists.php.net; talk@nyphp.org > > Subject: [PHP] Help! Can't set cookie or redirect!!! > > > > I am getting the following errors attempting to set a cookie and > redirect: > > > > Warning: Cannot add header information - headers already sent by > (output > > started at /users/ppowell/web/my/process.php:5) in > > /users/ppowell/web/my/process.php on line 76 > > > > Warning: Cannot add header information - headers already sent by > (output > > started at /users/ppowell/web/my/process.php:5) in > > /users/ppowell/web/my/process.php on line 77 > > > > > > Lines: > > > > setcookie("valLayout", $id, time()+3600*24*30*12*100, > $SERVER_NAME); // > > WILL EXPIRE IN 100 YEARS.. UM YEAH > > header("Location: " . $HTTP_POST_VARS["refURL"]); > > > > The first time I ran this script it set the cookie just fine; > subsequent > > runnings of this script produce this error. What am I doing wrong, > > anyone? > > > > Thanx > > Phil > >

« previous php.general (#118031) next »