> When experimenting with a few simple lines of code
>
> <script language='php'> ---- This is line 14
> session_start();
> </script>
>
> I get the following errors:
>
> Warning: session_start(): Cannot send session cookie - headers already sent by
> (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15
What's on lines 1-13? Does it have whitespace or indents on line 14, like
in your mail? Any use of headers, get/set cookies, or sessions must happen
before any output such as HTML or print/echo is sent to the browser.
Generally, it's a good idea to have set-up code such as session_start() be
one of the very first things you call in a script.
Wrong:
<html><head /><body><?php session_start() ?></body></html>
Right:
<?php session_start() ?><html><head /><body /></html>
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php