php: how to shoow session variable on every php page
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10270155/session-variable-not-displaying">Session variable not displaying</a>  </p>
</blockquote>



<p>This is the code on index.php where i get session variable first time:</p>

<pre><code>session_start();
$_SESSION['User'] = $_POST['text'];
$sesvar = $_SESSION['User'];
</code></pre>

<p>when I go to another php page of same website and again come back to index.php session automatically get destroyed.I want session until user dont logout it.</p>

<p>For that I passed parameter of session variable again to index page and wrote the following code:</p>

<pre><code>if(isset($_SESSION['User']))
{
  $sesvar = $_GET['sid']; 
  session_start();
  //echo $sesvar;
}
</code></pre>

<p>Please help. </p>
