自动php表单使用javascript提交

i am working on a php form that should submit automatically after timer expires . and when form is submitted than i want to get all the data from from to another php page. i am doing

 if (isset($_GET['id']))

{
$query="SELECT * from Question_bank";
$result= mysqli_query($connection,$query);
confirm_query($result);
?>
        <form action="answer.php" name="form1" method="post" id="quiz">
        <?php
while ($read_all_data = mysqli_fetch_assoc($result))
{ 
    $_SESSION['id']=1;

$id=$read_all_data['question_id'];
$a=$read_all_data['a'];
$b=$read_all_data['b'];
$c=$read_all_data['c'];
$d=$read_all_data['d'];
 echo $read_all_data['question']."</br>";
 echo "A:<input type ='radio' value ='a'  name='$id' >".$read_all_data['a']."</br>";
 echo "B:<input type ='radio' value ='b'  name='$id' >".$read_all_data['b']."</br>";
 echo "C:<input type ='radio' value ='c'  name='$id' >".$read_all_data['c']."</br>";
 echo "D:<input type ='radio' value ='d'  name='$id' >".$read_all_data['d']."</br>";

}
}
?>
<input type="submit"  value="Submit_Quiz"  /> // it works fine in this way and auto submitted after timer reaches to zero

</form>

but i also want the name attribute in submit button to get all the values from form to next page. but when i put "name=submit" it doesnot submit automatically

<input type="submit"  value="Submit_Quiz" name="submit"  /> 

javascript code

<script type="text/javascript"> 

var startCountDown = document.getElementById('startCountDown');
startCountDown.addEventListener('click',function(){
    var startTime = document.getElementById('startTime').value;
    var startDate = document.getElementById('startDate').value;
    var duration = document.getElementById('duration').value;

    function checkDateTime(){
        setTimeout(function(){
            if(new Date(startDate + " "+ startTime) <= new Date()){
                display_c(duration);
            }else{
                checkDateTime();
            }
            document.getElementById('minutesLeft').innerHTML = Math.round((new Date(startDate + " "+ startTime) - new Date() )/ (1000*60));
            console.log('Minutes left ',(new Date(startDate + " "+ startTime) - new Date() )/ (1000*60));
        },1000);
    }
    checkDateTime();
   console.log('button clicked',startTime,startDate,duration); 
});

function display_c(start)
{
window.start = parseFloat(start);
var end = 0 // change this to stop the counter at a higher value
var refresh=1000; // Refresh rate in milli seconds
if(window.start >= end ){
mytime=setTimeout('display_ct()',refresh)
}
else 

    callback();
}

 function callback(){
    window.setTimeout(function() {
    document.forms['form1'].submit();
}, 500);
      }
/*double seconds = milliseconds / 1000.0;*/

function display_ct() {
// Calculate the number of days left
var days=Math.floor(window.start / 86400); 
// After deducting the days calculate the number of hours left
var hours = Math.floor((window.start - (days * 86400 ))/3600)
// After days and hours , how many minutes are left 
var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60)
// Finally how many seconds left after removing days, hours and minutes. 
var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)))

var x = window.start + "(" + hours + " Hours " + minutes + " Minutes and " + secs + " Secondes " + ")";


document.getElementById('ct').innerHTML = x;
window.start= window.start- 1;

tt=display_c(window.start);
}

</script>

please help me

instead of mytime = setTimeout('display_ct()',refresh)

write mytime = setTimeout('display_ct',refresh)

may be it will help

Use like below.

window.onload=function(){ 
    window.setTimeout(document.quiz.submit.bind(document.quiz), 5000);
};

OR

window.onload=function(){ 
    window.setTimeout(function() { document.quiz.submit(); }, 5000);
};

For more you can check it out Auto submit form after 5 seconds