Possible Duplicate:
Headers already sent by PHP
I'm facing a problem while trying to pass variables from one page to another (php) I have page 1 which automatically load page 2 when you access it (using jquery). In order to page 2 work properly I need to pass 2 variables so here is my way to do so:
on Page 1:
session_start();
$_SESSION['username'] = $username;
$_SESSION['user_id'] = $user_id;
on Page 2:
session_start();
$username = $_SESSION['username'];
$user_id = $_SESSION['user_id'] ;
On the first load, it doesn't work. If I refresh, everything is fine. If I go to another computer or clear the cache of the current browser, I go through the same problem, On the first load, it doesn't work. after refreshing, everything is fine.
error log message:
[01-Oct-2012 20:02:59] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /public_html/php/info.php:1) in /public_html/php/info.php on line 26
does anyone have an idea what is the cause of this issue?