Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: problem with php sessions
11-01-2006, 04:02 PM #1
- Join Date
- Aug 2006
- Thanked 0 Times in 0 Posts
problem with php sessions
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, 05:43 PM #2
- Join Date
- Oct 2006
- Denver, Colorado USA
- Thanked 316 Times in 308 Posts
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.
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.