Jump to content

Header warnings


mjsulliv

Recommended Posts

In my ongoing but scattered learning / work on web programming I’ve more than once encountered a “header” problem. In the most recent occurrence I found something interesting as described below. I have a php file called from another page via “onclick="location.href=…”. The called page uses a “session_start()” call to get access to global variables. When the enclosing “<?php “ is NOT on the very first line of the file I get:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent…

But if it is on the first line there is no error. I’d love to know why this is. Any thoughts would be appreciated.

Link to comment
Share on other sites

it means something is sending something to the web browser before your PHP starts. this can include whitespace. so make sure the opening <?php is the very first line.

Link to comment
Share on other sites

Hi!I Think You Are Using session_start(); In Your Page Multiple Times, Check Out First...If Not... Then Add These Codes:<?php ob_start(); ?> session_start(); // Be Sure That You Are Using session_start(); 1 Time In 1 One.?>Your All CODE<?php ob_flush();?>OR<?php ob_start(); ?> session_start(); // Be Sure That You Are Using session_start(); 1 Time In 1 One. //Your All CODE ob_flush();?>

Link to comment
Share on other sites

Yes! A great explanation of what's going on in my code; though "headers" themselves are still fuzzy.Thanks --- MikeBTW I like your reference / link to Babbage. From my history of science classes in college I remember his concern about human "transcription" being one of the biggest problems in information handling; thus his construction of a printing device for mechanical calculators.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...