Jump to content

PHP Submit Form Timer?


Recommended Posts

I'm currently constructing an online exam which requires a timer, and when the timer is finished it needs to submit the form on the current page and move to the next page, without allowing the user to go backwards... wondering if this is possible in PHP and if so where should I start? I've been trying to figure this out for a few hours and have done quite a bit of research and attempted a few things, but the only conclusion I can come to is that I will have to use JavaScript, but I would prefer to do it in PHP if it is possible.

Link to comment
https://forums.phpfreaks.com/topic/201935-php-submit-form-timer/
Share on other sites

Don't know if you use just PHP as a normal redirect will not submit as well.  I think that you may have to resort to using JavaScript. 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<SCRIPT LANGUAGE="JavaScript"><!--
setTimeout('document.test.submit()',5000);
//--></SCRIPT>

</head>

<body>
<form name="test" id="form1" method="post" action="http://www.php.net/search.php">
  <p>
    <input name="pattern" type="text" id="pattern" />
    <input name="show" type="hidden" id="show" value="quickref" />
  </p>
  <p><input type="submit" name="next" value="Next" />
   </p>
</form>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.