countdown timer for online test
how can i add timer to my online test which allows me to
-1 time your testing
2-if the countdown is finish the form will submit
3- after submit i need to give score the questions that he has already answered it
and give zero for the questions he didn't answer it
4- if the examine try to refresh the page or go to another page the form will submit
5-you can not submit empty form
i hope you can help me guys because i will need this
<html>
<head>
<title> </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<div id="container">
<div id="header">
<center>
<p style="font-size:20pt; color: blue;"> </p>
</center>
<div id="paper_header">
<div style="float:right; margin-left:30px; padding-right:40px;"> : <p><?php echo $_SESSION['examinee_name'];?></p></div>
<div style="float:right;margin-left:10px;margin-right:40px;"> : <p><?php echo $_GET['lang'];?></p></div>
<div style="float:right;margin-right:40px;">:<p><?php echo $_GET['test_name'];?></p></div>
</div>
</div>
<div id="content">
<?php
include ("mysql_connect.php");
$test_id = $_GET['test_id'];
$sql ="Select * from question where test_id='$test_id'";
$res = mysqli_query($connection, $sql);
$noq = mysqli_num_rows($res);
?>
<form action="test_evaluation.php" method="post">
<legend> </legend>
<center><p><label> :</label>
<?php echo mysqli_num_rows($res);?>
</p></center>
<?php
$i = 0;
$j = 0;
$question_id = array();
while ($row = mysqli_fetch_array($res)){
$i = $i + 1;
$qtext = $row['question_text'];
$qid = $row['question_id'];
$question_id[] = $qid;
echo "<label> #".$i."</label><br>";
echo "<textarea readonly name='"."q".$i."' rows='10' cols='50'>".$qtext."</textarea><br>";
echo '<label style="margin:15px;"> :</label><br>';
$query="select * from answers where question_id ='$qid'";
$result = mysqli_query($connection, $query);
while($rec = mysqli_fetch_array($result)){
$j = $j +1;
$ans = $rec['answer_text'];
$ansid = $rec['answer_id'];
echo '<input readonly class="choice" type="text" name="'.'choice'.$i.$j.'" value="'.$ans.'" id="choice'.$i.$j.'" />';
echo '<input class="correct" type="radio" checked name="'.'correct'.$i.'" value="correct'.$i.$j.'"/><br>';
}
echo "<br><br>";
$j=0;
}
$_SESSION['num_of_questions'] = $noq;
$_SESSION['test_id'] = $test_id;
$_SESSION['q_ids']= $question_id;
?>
<center><input style="color:blue; font-size:14pt; width:100;"type="submit" value=" "/></center>
</form>
</div>
<div id="footer" dir="rtl">
<p> ©2014 </p>
</div>
</div>
</body>
</html>
1 Answer(s)