title: PHP Session Variable is Being Reset
body: <p>I've been looking at a problem in a script that is running on a PHP 4 server (I know... They are upgrading, but they need a fix for the servers still on PHP 4.)</p>
  
  <p>I am having an issue with session variables being reset to a different value at the beginning of the next page. This is the test that I ran to get to this point and now I'm not sure what's happening.</p>
  
  <p>Page Structure: 
  main.php -> calls start_page.inc first.
  main.php -> calls footer.inc last.</p>
  
  <p>Here is the steps that are happening and what I can not figure out:</p>
  
  <p><code>start_page.inc: echos 'test2'</code> (start page prints out the value of <code>$_SESSION['test']</code>)</p>
  
  <p><code>default.php: echos 'test2'</code> (default.php prints out the value of <code>$_SESSION['test']</code>)</p>
  
  <p><code>default.php: SET 'test2'</code> (default.php sets the value of <code>$_SESSION['test']</code> to <code>test2</code>)</p>
  
  <p><code>footer.inc: SET 'test'</code> (footer.inc sets the value of <code>$_SESSION['test']</code> to <code>test</code>)</p>
  
  <p><code>footer.inc: echos 'test'</code> (footer.inc prints out the value of <code>$_SESSION['test']</code>)</p>
  
  <p>Regardless of how many times I refresh the page, it always comes out this way with only one exception. The first time the session variable is set, it echos <code>test</code> on the next refresh.</p>
  
  <p>Anyone understand why / how this is happening and how I might fix this? I tested these files on a PHP 5 server and am actually having the same result.</p>
  
  <p>The first two echo's should always be <code>test</code>, unless I am missing something.</p>
  
  <p>I've tried stripping this down to a test page with no additional values and can not seem to reproduce it... The test variable is NOT being overwritten. I created it specifically for this test.</p>