Siby Xavier February 2016

Countdown timer in php using mysql

I want a countdown timer that countdown from certain minutes in a form page. when countdown ends redirect to specific page..

I am trying to create a quiz page that submit when the countdown ends.Please help me to do that... Thankyou...

Answers


DurtyFree February 2016

You have to use javascript on the client side to auto submit your form.

The code for the javascript would look like this

<script type="text/javascript">
 $(document).ready(function() {
   setTimeout(function(){
      $('#quizform').submit();
    },10000);
});
</script>

And your form would look like this..

<form action="postquiz.php" method="POST" id="quizform">

edit: keep in mind as it is only client side, ( this can be cheated ) you still need to some how validate the time on the server side. You could use some timestamps for this ( one before he is starting the question and one after submitting, then you could just go for checking if the time is okay )

Post Status

Asked in February 2016
Viewed 2,939 times
Voted 4
Answered 1 times

Search




Leave an answer