View Full Version : problem with php sessions

11-01-2006, 05:02 PM

A visitor selects some options from a page and press the submit button,then the second page shows his selected options and there he fill his details and again press the submit button then the selected options with his details is stored in db

i have used sessions to move the data from one page to another.with localhost it is working good but when i upload the scripts to my site it is showing following warnings.how to overcome with this.

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

your help will appreciated.


11-01-2006, 06:43 PM
My guess is that output buffering is turned on either in your php.ini or a .htaccess file on your local test system, but this is not the case on the actual server.

Any thing that is output to the browser prior to the session_start() statement will cause this error and prevent sessions from working.

You either need to correct the logic on the page (if a page is going to use a session anywhere on it, the session_start() should be at the beginning of the code on the page) or you need to make use of output buffering to work around the problem.