title: PHP Store Variables across multiple form submissions
body: <p>EDIT: Question had a simple answer: the $_SESSION variable. Thanks to RiggsFolly for that.</p>
  
  <p>Suppose I would like to save the users data to a variable that they would later be able to access for one reason or another, and I need the value in that variable to be persistent across form submissions and page refreshes.</p>
  
  <p>What is the 'best' (in this case the most efficient) way to do this in PHP?</p>
  
  <p>Here's a code sample illustrating the issue: It consists of three buttons for submitting data, saving data, and loading data. It does not work, but merely conveys the idea.</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;BODY&gt;
  &lt;? 
  
      /* If Save Pressed --&gt; Stored the value in a variable that will persist across successive submissions/refreshes*/
      if(isset($_GET['save'])){
          $_GET['saved'] = $_GET['value'];
      }
  
      /* If Submit Pressed -&gt; Display the value entered in the text box next to Value:*/
      if(isset($_GET['submit'])){
          $loadedValue = $_GET['value'];
      }
  
      /* If Load Pressed -&gt; Loads the previously stored value if there is one and displays it next to Value: */
      if(isset($_GET['load'])){
          $loadedValue = $_GET['saved'];
      }
  ?&gt;
  &lt;form&gt;
  &lt;!--  New Value Entry Field --&gt;
  &lt;input type="text" name="value" &gt;
  
  &lt;!-- Space Characters --&gt;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;          
  
  &lt;!-- Original Value Text --&gt;
  &lt;u&gt;Value:&lt;/u&gt; &lt;?= $loadedValue ?&gt;   
  
  &lt;!-- Line Break Characters --&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;!-- Button To Change Values --&gt;
  &lt;input type="submit" name="submit"value="Submit"&gt;   
  
  &lt;!-- Button To Save Values --&gt;
  &lt;input type="submit" name="save"value="Save"&gt;   
  
  &lt;!-- Button To Load Values --&gt;
  &lt;input type="submit" name="load"value="Load"&gt;   
  &lt;/form&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>