Terry J Daichendt schreef:
I'm pasting this code from the example at php.net and getting these

which example might that be, with 1000's of built in functions you
can imagine there is probably more than one.

errors. Can anyone determine what I'm doing wrong?


yes. but can your read? the error message tells you what is wrong.

"output started at /home/terryswe/public_html/hisdailybread/session.php:6"

basically the body of a http request must come after the http headers,
sessions make use of cookies. the first echo (or print) statement effectively
starts the output of the http request body after which no headers can be sent
anymore.

what is also plainly obvious is that the example code you posted is *NOT*
the code your trying to run:

there is no session_start() called on line 9 in the example you gave.

<?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time']     = time();

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';

don't bother with the above line, it's shite. which is a
short way of saying that you have no idea as to the security
ramifications so best not to even go there.

?>


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9
Welcome to page #1

Terry




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to