title: php form 2 step confirmation
body: <p>i try to challenge my self but i stuck(
  I try to create a php form with 2 steps confirmation:</p>
  
  <ol>
  <li><p>When the user fill up the form and hit Submit, it checks all the conditions(name, pass etc.). If everything ok automatically redirecting the user.</p></li>
  <li><p>After redirecting (to the same page) the user can check all the details  again.
  If they ok, hit again the submit button which redirects to the final page.</p></li>
  </ol>
  
  <p>I stuck on the 2nd phase...how to redirect to the final page?</p>
  
  <p>I'm very beginner so i'm curios what could be done better or any advise.</p>
  
  <pre><code>&lt;?php
   // the php code 
  session_start();
  
  
  if ($_SERVER['REQUEST_METHOD'] == "POST") {
  
  // setting up the variables
  
  $title = $_POST['title'];
  $fName = trim(filter_input(INPUT_POST,'fName', FILTER_SANITIZE_STRING));
  $lName = trim(filter_input(INPUT_POST,'lName',FILTER_SANITIZE_STRING));
  $age = intval($_POST['age']);
  
  
  $_SESSION['title'] = $title;
  $_SESSION['fName'] = $fName;
  $_SESSION['lName'] = $lName;
  $_SESSION['age'] = $age;
  
  
  
  //checking for possible errors
  if ( $fName == "" || strlen($fName) &lt;= 2 ) {
      $errorMsg1 = "&lt;span&gt;Provide your First name!(minimum 3 characters)&lt;/span&gt;";
      $status = false;
  
  }
  else if ( $lName == "" || strlen($lName) &lt;= 2 ) {
      $errorMsg2 = "&lt;span&gt;Provide your Last name!(minimum 3 characters)&lt;/span&gt;";
      $status = false;
  
  }
  else if ( $age &lt; 18 ) {
      $errorMsg3 = "&lt;span&gt;You must be 18 or above!&lt;/span&gt;";
      $status = false;
  
  }
  
  else {  $status = true; }
  
  // redirecting to done page
  
  if ($status) {
      header("Location:TEST ZONE.php?status=awaiting");
      }
    }
  
   ?&gt;
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="wrapper"&gt;
  &lt;?php
  
  if ( isset($_GET['status']) &amp;&amp; $_GET['status'] == "awaiting" ) {
      echo "&lt;form&gt;"
      . "Check your Details!&lt;br&gt;"
      . $_SESSION['title'] . "&lt;br&gt;"
      . $_SESSION['fName'] . "&lt;br&gt;"
      . $_SESSION['lName'] . "&lt;br&gt;"
      . $_SESSION['age'] . "&lt;br&gt;"
     // **NOW WHEN I'M in the awaiting phase, i don't know what to do(**
  
      . "&lt;input type='submit' name='submit'/&gt;";
  
      echo "&lt;/form&gt;";
     }
  
     else {  ?&gt;
      &lt;form action="TEST ZONE.php" method="post"&gt;
      &lt;h3&gt;Register Form &lt;/h3&gt;
  
      &lt;label for="title"&gt;Title &lt;/label&gt;
      &lt;select name="title"&gt;
          &lt;option name="mr"&gt;Mr&lt;/option&gt;
          &lt;option name="ms"&gt;Ms&lt;/option&gt;
      &lt;/select&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
      &lt;label for="fName"&gt;First Name&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" name="fName" id="fName" value="&lt;?php if    (isset($fName)) { echo $fName; } ?&gt;"&gt;&lt;br&gt;&lt;?php
      if (isset( $errorMsg1 )) {
          echo $errorMsg1;
      }
      ?&gt;&lt;br&gt;&lt;br&gt;
  
      &lt;label for="lName"&gt;Last Name&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" name="lName" id="lName" value="&lt;?php if (isset($lName)) { echo $lName; } ?&gt;"&gt;&lt;br&gt;&lt;?php
      if (isset( $errorMsg2 )) {
          echo $errorMsg2;
      }
      ?&gt;&lt;br&gt;&lt;br&gt;
  
      &lt;label for="age"&gt;Age&lt;/label&gt;&lt;br&gt;
      &lt;input type="text" name="age" id="age" value="&lt;?php if (isset($age)) { echo $age; }?&gt;"&gt;&lt;br&gt;&lt;?php
      if (isset($errorMsg3)){
          echo $errorMsg3;
      } ?&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="submit" value="Submit"&gt;&lt;input type="reset"&gt;
  
  &lt;/form&gt; &lt;?php } ?&gt;
    &lt;/div&gt;
  
  
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>