Re: Newbie error with cookies and headers already declared
| From: | Martin Geisler | Date: | Sat, 22 May 2004 11:01:54 +0000 |
| Subject: | Re: Newbie error with cookies and headers already declared | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186767@lists.php.net to get a copy of this message | ||
cparker@swatgear.com (Chris W. Parker) writes:
> 2. you cannot create/write a session value after you send any html
> output to the client.
That's not entirely true --- you just have to call session_start()
before any HTML output is sent to the browser, for session_start()
must be able to set the session cookie (if using session cookies that
it). The very first example here illustrates this:
http://php.net/session-start
There the session_start() is called, then some output is sent to the
browser, and later the three session variables 'favcolor', 'animal',
and 'time' is set.
The session variables can be set and updated at any time because this
only associates data with the session on the server side.
--
Martin Geisler My GnuPG Key: 0xF7F6B57B
PHP EXIF Library | PhpWeather | PhpShell
http://pel.sf.net/ | http://phpweather.net/ | http://gimpster.com/
Read/write EXIF data | Show current weather | A shell in a browser