title: How to make a webpage retain variables from form?
body: <p>Sorry if I'm duplicating threads here, but I wasn't able to find an answer to this anywhere else on StackOverflow. </p>
  
  <p>Basically what I'm trying to do is make a list in which variables entered in a form by a user can be kept. At the moment, I have the code which makes this possible, and functional, however the variables entered in the form only appear on the list after the user hits submit... As soon as I refresh the page or go to the page from somewhere else, the variables disappear. Is there any way I can stop this from happening?</p>
  
  <p>Edit: here are the codes:</p>
  
  <pre><code>//Page 1
  &lt;?php
  
  session_start(); 
  
  $entries = array(
  0 =&gt; $_POST['signup_username'],
  1 =&gt; $_POST['signup_email'],
  2 =&gt; $_POST['signup_city']);
  
  $entries_unique = array_unique($entries);
  $entries_unique_values = array_values($entries_unique);
  
  echo "&lt;a href='Page 2'&gt;Link&lt;/a&gt;";
  
  $_SESSION['entries_unique_values'] = $entries_unique_values;
  
  ?&gt;
  
  
  //Page2 
  &lt;?php
  
  session_start(); 
  
  $entries_unique_values = $_SESSION['entries_unique_values'];
  
  foreach($entries_unique_values as $key =&gt; $value) {
  $ValueReplace = $value;
  echo "&lt;br /&gt;&lt;a href='http://example.com/members/?s=$ValueReplace'&gt;" . $value . "&lt;/a&gt;&lt;br/&gt;";
  }
  
  ?&gt;
  </code></pre>