title: echo or carry form input information over several pages and then input data to mysql?
body: <p>I am trying to carry or echo the information that a user puts in a form, there are 3 forms the user needs to complete which are all on different pages, by the time they get to the 4th page i need all this information to be inserted into the mysql database all together.</p>
  
  <p>Now i have my sql query which puts the data into the database and this inputs the data fine but only puts in the data on the last page/which is the last form the user completes. 
  Any other previous information the user puts into the earlier forms is not input into mysql even though i am using the values.</p>
  
  <p>i think you need to create a session to carry the data over to the next page, and so i am trying to do that like so, but its not working:</p>
  
  <p>page 1 / form 1:</p>
  
  <pre><code>&lt;?php
  session_start();
  ?&gt;
  
  &lt;form class="" method="post" action="register_p2.php"&gt;
  
                  &lt;div class="row first_name"&gt;
                      &lt;input type="text" id="first_name" name="first_name" placeholder="First Name" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row last_name"&gt;
                      &lt;input type="text" id="last_name" name="last_name" placeholder="Last Name" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row email"&gt;
                      &lt;input type="email" id="email" name="email" placeholder="Email"  /&gt;
                  &lt;/div&gt;
  
                  &lt;input type="submit" value="Next &gt;"  /&gt;
  
              &lt;/form&gt;
  </code></pre>
  
  <p>page 2 / form 2:</p>
  
  <pre><code>&lt;?php
  session_start();
  // other php code here
  
  $_SESSION['first_name'] = $first_name;
  $_SESSION['last_name'] = $last_name;
  $_SESSION['email'] = $email;
  ?&gt;
  
  &lt;form name="myForm" method="post" action="register_p3.php" onsubmit="return validateForm()" &gt;
  
                  &lt;div class="row date_of_birth"&gt;
                      &lt;input type="text" id="date_of_birth" name="date_of_birth" placeholder="D.O.B 10/02/1990" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row number"&gt;
                      &lt;input type="text" id="contact_number" name="contact_number" placeholder="Mobile Number" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row confirm"&gt;
                      &lt;input type="text" id="confirm" name="confirm" placeholder="Are You a UK resident?"  /&gt;
                  &lt;/div&gt;
  
                  &lt;input type="submit" value="Next &gt;"  /&gt;
  
              &lt;/form&gt;
  </code></pre>
  
  <p>page 3 / form3:</p>
  
  <pre><code>    &lt;?php
      session_start();
      // other php code here
  
      $_SESSION['first_name'] = $first_name;
      $_SESSION['last_name'] = $last_name;
      $_SESSION['email'] = $email;
      $_SESSION['dat_of_birth'] = $date_of_birth;
      $_SESSION['number'] = $number;
      ?&gt;
  
  &lt;form class="" method="post" action="register_p4.php"&gt;
  
                  &lt;div class="row date_of_birth"&gt;
                      &lt;input type="text" id="display_name" name="display_name" placeholder="Display Name" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row password"&gt;
                      &lt;input type="password" id="password" name="password" placeholder="Password" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="row password2"&gt;
                      &lt;input type="password" id="password2" name="password2" placeholder="Password (Confirm)"  /&gt;
                  &lt;/div&gt;
  
                  &lt;input type="submit" value="Next &gt;"  /&gt;
  
              &lt;/form&gt;
  </code></pre>
  
  <p>and then on the final page i try to collect all the information like so and input it into the database:</p>
  
  <pre><code>&lt;? ob_start(); ?&gt;
  &lt;?php
  // GET ACCOUNT INFORMATION FROM FORM AND ASSIGN VARIABLES
  $first_name = $_POST['first_name'];
  $last_name = $_POST['last_name'];
  $email = $_POST['email'];
  $date_of_birth = $_POST['date_of_birth'];
  $contact_number = $_POST['contact_number'];
  $display_name = $_POST['display_name'];
  $password = $_POST['password'];
  ?&gt;
  &lt;?php
  /*
  // ECHO ACCOUNT INFORMATION
  echo "&lt;strong&gt; Account Information: &lt;/strong&gt;";
  echo "&lt;br /&gt;";
  echo First Name: ";
  echo "&lt;br /&gt;";
  echo $first_name;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "Last Name: ";
  echo "&lt;br /&gt;";
  echo $last_name;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "Email: ";
  echo "&lt;br /&gt;";
  echo $email;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "Password: ";
  echo "&lt;br /&gt;";
  echo $password;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "date_of_birth: ";
  echo "&lt;br /&gt;";
  echo $date_of_birth;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "Contact_number: ";
  echo "&lt;br /&gt;";
  echo $contact_number;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  echo "display_name: ";
  echo "&lt;br /&gt;";
  echo $display_name;
  echo "&lt;br /&gt;";
  echo "&lt;br /&gt;";
  */
  ?&gt;
  </code></pre>