Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
63
rated 0 times [  64] [ 1]  / answers: 1 / hits: 16982  / 11 Years ago, wed, september 4, 2013, 12:00:00

Here is i want to happened to my HTML code.. i have an html code that is written in a php code and i want to add a java script(or anything that can help me) to automatically submit my form after 10 seconds.. I am creating an examination system for my school and i want it to be time bounded.. this is the code..



 echo <form action=PostTest1.php method=Post>;
echo <tr><td>;
echo $row['Description'] . <br>;
echo <input type=radio name=Answer value=A> A.) . $row['Ans1'];
echo <br>;
echo <input type=radio name=Answer value=B> B.) . $row['Ans2'];
echo <br>;
echo <input type=radio name=Answer value=C> C.) . $row['Ans3'];
echo <br>;
echo <input type=radio name=Answer value=D> D.) . $row['Ans4'];
echo <br>;
echo <input type=Submit value=Submit name=submit>;
echo </td></tr>;
echo </form>;


i wonder what language you can help me.. its either JS or JQ.. thankyou very much! :)


More From » php

 Answers
5

using jquery setTimeout()



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


add this inside you head tag <head> .. better you add id to your form and use id selector $('#formID').submit();



updated



using form id to be specific..



echo <form action=PostTest1.php method=Post id='formID'>;
.....


and



setTimeout(function(){
$('#formID').submit();
},10000);

[#75913] Tuesday, September 3, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brodyfrancisi

Total Points: 1
Total Questions: 102
Total Answers: 89

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
brodyfrancisi questions
;