Sessions warnings
Posted: Mon Mar 14, 2005 6:44 am
I am devloped a website using php and I'm currently using sessions to pass php variables between scripts.
The code I have is doing exactly what I want i.e. I can access the value of the variables from one script in another.
Though the problem I'm having is that I'm getting the below warning messages. Any suggestions why I am getting such warnings would be greatly appreciated.
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\16182014\Scripts\userHomepage.php:10) in F:\16182014\Scripts\userHomepage.php on line 21
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\16182014\Scripts\userHomepage.php:10) in F:\16182014\Scripts\userHomepage.php on line 21
Script 1
Script 2
The code I have is doing exactly what I want i.e. I can access the value of the variables from one script in another.
Though the problem I'm having is that I'm getting the below warning messages. Any suggestions why I am getting such warnings would be greatly appreciated.
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\16182014\Scripts\userHomepage.php:10) in F:\16182014\Scripts\userHomepage.php on line 21
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\16182014\Scripts\userHomepage.php:10) in F:\16182014\Scripts\userHomepage.php on line 21
Script 1
Code: Select all
<?php session_start();
echo "$_SESSION[rights]: $_SESSION[firstname] $_SESSION[middlename] $_SESSION[surname]";?>Code: Select all
session_start();
session_register('firstname');
session_register('middlename');
session_register('surname');
session_register('rights');
while($Row = mysql_fetch_row($result))
{ $firstname = $Row[0];
$middlename = $Row[1];
$surname = $Row[2];
$rights = $Row[6];
}