title: How to display form values as a preview before submitting into database?
body: <p>in my code its directly saving the values into database but I want to show <strong>preview page for Textfield values</strong> and then after I want to submit the details into Database.How to do that?
      please guide me</p>
  
  <pre><code>  &lt;?php
      if(isset($_POST['submit'])){
        $name=$_POST['name'];
        $course=$_POST['course'];   
  
         $query="insert into student_tbl(`name`,`course`) values('$name','$course')";
          if ($conn-&gt;query($query) === TRUE){
             header("location: home.php");
           }
         else {
          echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
          }
          $conn-&gt;close();  
         }
      ?&gt;
  </code></pre>
  
  <p>This is simple form where am trying with only two values       </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;link rel="shortcut icon" href="img/favicon.png"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form action="" method="POST" id="myform" class="mform" enctype="multipart/form-data"&gt;
          &lt;div class="col-sm-12"&gt;
              &lt;label for="name"&gt;name:&amp;nbsp;&lt;/label&gt;
              &lt;input class="form-control" type="text" id="name" name="course" /&gt;
          &lt;/div&gt;
          &lt;div class="col-sm-12"&gt;
              &lt;label for="course"&gt;Course:&amp;nbsp;&lt;/label&gt;
              &lt;select name="course" id="course"&gt;
                  &lt;option value="" disabled&gt;select users&lt;/option&gt;
                  &lt;option value="Computer"&gt;Computer&lt;/option&gt;
                  &lt;option value="Physics"&gt;Physics&lt;/option&gt;
                  &lt;option value="Chemistry"&gt;Chemistry&lt;/option&gt;
                  &lt;option value="Maths"&gt;Maths&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;div class="col-sm-12"&gt;
              &lt;input class="form-control" type="submit" value="Preview" /&gt;
              &lt;input class="form-control" type="submit" formaction="formdata.php" value="Cancel" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>