title: loosing data on page refresh php session
body: <p>I am posting data from one site to another, then turning that posted data into a session.</p>
  
  <p><strong>form from other site</strong></p>
  
  <pre><code>&lt;form action="https://www.122.co.uk/11/" method="POST"&gt;
  &lt;input type="hidden" name="userid" value="1010101"&gt;
  &lt;input type="submit" value="Go" style="font-size:14px; padding:20px;"&gt;
  </code></pre>
  
  <p></p>
  
  <p>I then post this data to my new site where I turn it into a variable <code>$userid</code></p>
  
  <p>then checking that the variable is empty or not, if not show some code.</p>
  
  <p><strong>check variable is not empty</strong> </p>
  
  <pre><code>if (!empty($userid)) {
      ?&gt;
      &lt;div class="container"&gt;
          &lt;?php
          echo "&lt;hr&gt;";
          echo "You Are Logged In,&lt;/br&gt;";
          echo "Your User ID is &lt;strong&gt;" . $_POST['userid'] . "&lt;/strong&gt;.";
  </code></pre>
  
  <p>When I refresh the page with a button click I loose the session data, so the code in the check dose not show.</p>
  
  <p>how do I have a button to refresh to page and keep session data ?</p>
  
  <p><strong>button to refresh</strong></p>
  
  <pre><code>&lt;button class="btn btn-primary hidebutton showbuttonv2" role="button" id="homebutton" onClick="history.go(0)"&gt;Home&lt;/button&gt;
  </code></pre>
  
  <p><strong>Full code spinet</strong> </p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  $_SESSION['userid'] = $_POST['userid'];
  
  $userid = $_SESSION['userid'] = $_POST['userid'];
  
  //$_SESSION["userID"] = $userid;
  
  if (!empty($userid)) {
      ?&gt;
      &lt;div class="container"&gt;
          &lt;?php
          echo "&lt;hr&gt;";
          echo "You Are Logged In,&lt;/br&gt;";
          echo "Your User ID is &lt;strong&gt;" . $_POST['userid'] . "&lt;/strong&gt;.";
  </code></pre>