title: PHP Session Variables Not Preserved
body: <p>I am unable to use session variables on a page other than the one where they are set, IOW they act like non-session variables.  I have found a similar question posted in half a dozen other similar fora, but the answer in those other cases always turns out not to apply. </p>
  
  <p>Here are my files:</p>
  
  <p><em>sess1.php</em></p>
  
  <pre><code>&lt;?php
  session_start();
  
  session_register("userid");
  session_register("textvar");
  
  $_SESSION['userid'] = 10333 ;
  $_SESSION['textvar'] = TextVariable ;
  
  echo "&lt;p&gt;User ID is: " . $_SESSION['userid'] . "&lt;/p&gt;" ;
  echo "&lt;p&gt;Another variable is: " . $_SESSION['textvar'] . "&lt;/p&gt;" ;
  ?&gt;
  &lt;p&gt;Go to the &lt;a href="sess2.php"&gt;next page&lt;/a&gt;.&lt;/p&gt;
  </code></pre>
  
  <p>and,
  <em>sess2.php</em></p>
  
  <pre><code>&lt;?php
  session_start();
  
  echo "&lt;p&gt;The userid session variable is: " . $_SESSION['userid'] . "&lt;/p&gt;";
  echo "&lt;p&gt;The other session variable is: " . $_SESSION['newvar']. "&lt;/p&gt; ";
  ?&gt;
  </code></pre>
  
  <p>The browser output in each case is:</p>
  
  <p><em>sess1.php</em></p>
  
  <blockquote>
    <p>User ID is: 10333</p>
    
    <p>Another variable is: TextVariable</p>
    
    <p>Go to the [next page].</p>
  </blockquote>
  
  <p>and,
  <em>sess2.php</em></p>
  
  <blockquote>
    <p>The userid session variable is:</p>
    
    <p>The other session variable is:</p>
    
    <p>Go to the [last page].</p>
  </blockquote>
  
  <p>A few things it is NOT:</p>
  
  <ul>
  <li>I do have session_start() at the top of both files.</li>
  <li>The variables directory is writable, and the session variables are showing up there. (I have about a hundred little files called sess_b62, that have this inside: 'userid|i:10333;textvar|s:12:"TextVariable";'.)</li>
  <li>phpinfo() tells me that the php.ini file is being read correctly and the lifetime is set to the default, 0, i.e. until the browser is closed.</li>
  </ul>
  
  <p>I'm at my wit's end.  Any suggestions?</p>
  
  <p>Thanks so much.</p>