Forum Moderators: coopster
example.htm calls external .php file using
include("../file.php");
Inside file.php, session is started using
session_start();
Now, when I view example.htm, the form loads within the document just fine, but there is a warning:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /example.htm:6) in /file.php on line 14
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /example.htm:6)
Apparently, a session can't be started in the php file since one was already started when information was first sent to the browser from example.htm. So, my question is, how do I get around this? How can I pass the session info from the parent document to the php without starting a new one?
This is so irritating.
1) Make the first part of your page php and use output buffering
2) Make the first part of your page php and the first command a session_start();
When I say make the first part php, that means no html, or even spaces must come before the first <?php tag.
Additional hint ... look up SID in the php manual, if you wish to explicitly pass the session identifier.
Hope this helps.