Re: Cookies

From: Date: Wed, 25 Apr 2001 11:26:52 +0000
Subject: Re: Cookies
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8865@lists.php.net to get a copy of this message
I believe that the cookie part needs to be sent to the browser before the html. You can put the set cookies any where in the php portion as long as the first thing you send is the cookie stuff setcookie...... html header info... html.... not html header info..... setcookie html...... Hopes this helps John On Wed, 25 Apr 2001, Tobbe wrote: > Hi !! > > I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I > used the code example from the php manual from php.net put I only get the > error messages (down below) > > And how do i get back the var in to the page > > or is there another beter way to save the variables when reloading the page > > > ___________________ > > setcookie ("cookie[two]", $iCount); > setcookie ("cookie[one]", $sPhone); > if (isset ($cookie)) { > while (list ($name, $value) = each ($cookie)) { > echo "$name == $value<br>\n"; } } > > __________________ > Warning: Cannot add header information - headers already sent by (output > started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) > in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51 > > Warning: Cannot add header information - headers already sent by (output > started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) > in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52 > > > Thanks / Tobbe > > > >

« previous php.db (#8865) next »