title: $_SESSION values not holding!
body: <p>I'm writing a user login system, and I (like so many others) am having a problem with my sessions.</p>
  
  <p>Here's the pointer from the login script when the inputs are validated:</p>
  
  <pre><code>session_start();
  $_SESSION['id']=$id;
  header('location: memberhome.php');
  </code></pre>
  
  <p>Here's the first thing on memberhome.php:</p>
  
  <pre><code>&lt;?php
  session_start();
  $id=$_SESSION['id'];
  ?&gt;
  </code></pre>
  
  <p>And later in memberhome.php:</p>
  
  <pre><code>You are logged in as: &lt;?php echo $id; ?&gt;
  </code></pre>
  
  <p>The problem is $_SESSION['id'] is apparently empty so the echo $id prints nothing.</p>
  
  <p>An alternate that also does NOT work:</p>
  
  <pre><code>//removed session_start and $_SESSION bit from the top
  You are logged in as: &lt;?php session_start(); echo $_SESSION['id']; ?&gt;
  </code></pre>
  
  <p>NOW, here's the weird part. This method DOES work:</p>
  
  <pre><code>You are logged in as: &lt;?php echo session_start();$_SESSION['id']; ?&gt;
  </code></pre>
  
  <p>You can see the session_start() is moved AFTER the echo. This works when the page loads from the login script. However, upon refresh, it does NOT work once again.</p>
  
  <p>I've tried a bunch of alternatives and spent a few hours searching for answers in previous questions. I also looked at my phpinfo() for something fishy and found nothing. This is entirely what my progress is hinging on. Thanks!</p>