title: How to get post data after submitting form
body: <p>I am new to PHP and I am trying to get post data after my form has been submitted. The problem I have is that I can get the post data on my success.php page, but if I move away from that page and go to another I can no longer get the values. So my question is how can I get the post data on another page?</p>
  
  <p>My form</p>
  
  <pre><code>&lt;form name="message" method="post" action="success.php"&gt;
  First Name: &lt;input type="text" name="firstname" id="firstname"/&gt;
  &lt;p&gt;
  Last Name: &lt;input type="text" name="lastname" id="lastname"/&gt;
  &lt;p&gt;
  Message:&lt;br /&gt;
  &lt;textarea name="message" id="message" cols="45" rows="5"&gt;&lt;/textarea&gt;
  &lt;br /&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;&lt;/input&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>success.php</p>
  
  <pre><code>&lt;?php
  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $message = $_POST['message'];
  echo "Firstname: $firstname&lt;br/&gt;";
  echo "Lastname: $lastname&lt;br/&gt;";
  echo "Message $message";
  ?&gt;
  </code></pre>