title: Set a specific Time duration for page
body: <p>I would like to specify the duration of the display of a form. Suppose there is a variable with the value <code>x=(10)</code>, whenever I call this page, the timer should be based on the current time and the form should be displayed for 10 minutes and after this time the form should be sent automatically.</p>
  
  <pre><code>&lt;?php 
   include 'db_conn.php';
   if (isset($_GET['id'])) {
    $var=$_GET['id'];
  $query="SELECT * FROM addquiz WHERE quz_id='$var' ";
  $db=mysqli_query($conn,$query);
  $res=mysqli_fetch_array($db);
  $noquestions=$res['noquestion'];
  $quiz=$res['title'];
  }?&gt;
  
  &lt;div class="container"&gt;
  &lt;form  method="POST" class="form-horizontal" &gt;
  
  &lt;div style="margin-left: 30%;"&gt;&lt;b&gt;Your Quiz: &amp;nbsp; &amp;nbsp; &lt;?php echo $quiz;?&gt;&lt;/b&gt; &amp;nbsp; &amp;nbsp;  &amp;nbsp; 
  &lt;input type="text" name="user_name" placeholder="Enter Your Name" style="height: 30px; width: 30%;"&gt;&lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-md-12"&gt;
  &lt;div class="panel" style="margin:5%"&gt;
  
  &lt;?php 
  $count=1;
  $que="SELECT * FROM addques WHERE quz_id='$var'";
  $dbd=mysqli_query($conn,$que);
      while ($cmd=mysqli_fetch_array($dbd)) {
  
              $quest=$cmd['qusname'];
              $ans_id=$cmd['ans_id'];
              $opt1=$cmd['qpta'];
              $opt2=$cmd['optb'];
              $opt3=$cmd['optc'];
              $opt4=$cmd['optd'];
              $answ=$cmd['answer'];?&gt;
  &lt;b&gt;Question &amp;nbsp; &lt;?php echo $count++;?&gt;&amp;nbsp;:&lt;br&gt;&lt;?php echo $quest;?&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;
  &lt;fieldset&gt;
  &lt;input type="hidden" name="ansid[]" value="&lt;?php echo $ans_id; ?&gt;"&gt;
  &lt;input type="checkbox" name="ans[]" value="1"&gt;&lt;?php echo $opt1;?&gt;&lt;br&gt;&lt;br&gt;
  &lt;input type="checkbox" name="ans[]" value="2"&gt;&lt;?php echo $opt2;?&gt;&lt;br&gt;&lt;br&gt;
  &lt;input type="checkbox" name="ans[]" value="3"&gt;&lt;?php echo $opt3;?&gt;&lt;br&gt;&lt;br&gt;
  &lt;input type="checkbox" name="ans[]" value="4"&gt;&lt;?php echo $opt4?&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;/fieldset&gt;
  &lt;?php } ?&gt;
  &lt;button type="submit" name="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  &lt;div class="button" style="margin-left: 60%;"&gt; &lt;a href="result.php?name=&lt;?php echo $_POST['user_name'];?&gt;"  class="btn btn-info"&gt;View Result &lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt; 
  &lt;?php
  $i=0;
  if (isset($_POST['submit'])) {
      $name=$_POST['user_name'];
  while ( $i&lt;$noquestions  ) { 
  $query="INSERT INTO `result`(  `quz_id`, `ans_id`, `answer`,`user_name`) VALUES('";
  $query.=$var .  "', '"; 
  $query.=$_POST['ansid'][$i] .  "', '"; 
  $query.=$_POST['ans'][$i] .   "', '";
  $query.=$name .   "' )";
  
  
  $db=mysqli_query($conn,$query);
  $i++;
  }
  }
  ?&gt;
  </code></pre>