Jump to content

[SOLVED] Annoying error message with sessions?


Roy766

Recommended Posts

Hi everybody! I'm somewhat new to sessions, so this question may seem really stupid to all of you PHP gods.

 

Anyways, I'm trying to send a basic PHP variable between two pages through the use of sessions, and then I do some basic computations on the second page. The math I get on the second page is right, but I get these annoying error messages at the top of the page:

 

First page:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/www/roy766.freehostia.com/armygame.php:6) in /home/www/roy766.freehostia.com/armygame.php on line 8

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/roy766.freehostia.com/armygame.php:6) in /home/www/roy766.freehostia.com/armygame.php on line 8

 

Second page:

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/www/roy766.freehostia.com/armygame2.php:6) in /home/www/roy766.freehostia.com/armygame2.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/roy766.freehostia.com/armygame2.php:6) in /home/www/roy766.freehostia.com/armygame2.php on line 7

 

If someone could help it would be greatly appreciated! Thanks in advance!

 

Side-note:

  session_register();
  session_start();                      
  $_SESSION['budget'] = $budget;

 

 session_start();
$budget = $_SESSION['budget'];

Just the session_start() function needs to be at the top of the page or the top of the first included page it has to be processed first.

 

http://www.wallpaperama.com/forums/warning-session-start-function-session-start-cannot-send-session-t416.html

 

<?php

  session_start();

?>

 

everything else

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.