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
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.