title: To display a popup for specific time and then redirect to another page using php
body: <p>When I submit the form ,I want to display a jquery dialog(not alert) showing success message for a specific time and then it should redirect to a new page after that time is over.Please don't mark this question as duplicate,I know this question has been answered before but none of them gives me the desired result.
  Here is my html code-</p>
  
  <pre><code>&lt;form action="submit.php" method="POST"&gt;
  Name:&lt;input type="name" id="name" /&gt;
  Age:&lt;input type="age" id="age" /&gt;
  &lt;input type="submit" name="save" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is my submit.php code-</p>
  
  <pre><code>&lt;?php
  include('db.php');
  $sql ="INSERT INTO details(`name`) VALUES ('".$_POST["name"]."','".$_POST["age"]."')";
   if ($conn-&gt;query($sql) === TRUE) {
   /*here i want to display the dialog and then redirect to new page i.e.-header('Location:enter.php')*/
    header('Location:enter.php');
  } else {
  echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
  }
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>I have tried <code>onsubmit=popup();</code> ,but this does not gives me confirmation that the form has been submitted.</p>
  
  <pre><code>function popup(){
      $("#mess").dialog({});
      setTimeout(wait, 3000);   
     }
  </code></pre>
  
  <p>Thanks in advance.</p>