actually i want to make php code where action="" tag will depends upon 2 things,they are (i) submit button (ii) and timer here i can make a code which only works upon submit button. the code is given bellow: -------------------------------------------------- index.html ----------- <html> <body> <form name='form1' method='post' action='receive.php'> <!-- here a timer nedded --> <tr> (1) 1+1=?</br></tr> <tr><input type='radio' name='ques' value='1'> 1</br></tr> <tr><input type='radio' name='ques' value='2'> 2</br></tr> <tr><input type='radio' name='ques' value='3'> 3</br></tr> <tr><input type='radio' name='ques' value='4'> 4</br></tr> <input name='Submit' type='submit' value='submit'> </form> </body> </html> ---------------- receive.php ---------------- <?php $ans=$_POST['ques']; echo "You Enter: "."$ans"; ?> -------------------------------------------------- now, i want to make a timer that if i can't press submit button then the timer will automatically make a alert box(show:Your limited time is complete) after 1 minute.then pressing ok button its automatically take the action="receive.php" work and show the output. But if i press the submit button within 1 minute then this timer will do nothing...... [ i think i need js for alert box: if anyone know this please submit the code after check with my submitted code ]
I think building a timer with php is not a good idea. You can use javascript timer, which will run on client browser. you can develop a funciton like this function timer() { setTimeout("funct()",60000); } function funct() { alert("Your limited time is complete"); //do other things // you can disable the form input using document.getElementById("YOUR ID").disabled="disabled"; // so that your visitor cant answer after the time }
@ Sporsho, please sent me the full code after checking.....i am waiting.. [N.B: U can use my code as base,then for timer u can use new things]
oowww....i got it...its now working : its automatically redirect after 10 sec if i don't take any response: ---------------------------------------- <?php header('Refresh:10; url=receive.php');?> <html> <body> <form name='form1' method='post' action='receive.php'> <!-- here a timer will --> <tr> (1) 1+1=?</br></tr> <tr><input type='radio' name='ques' value='1'> 1</br></tr> <tr><input type='radio' name='ques' value='2'> 2</br></tr> <tr><input type='radio' name='ques' value='3'> 3</br></tr> <tr><input type='radio' name='ques' value='4'> 4</br></tr> <input name='Submit' type='submit' value='submit'> </form> </body> </html> ----------------------------------------