Page 1 of 1

load php page after particular time

Posted: Sat Feb 26, 2011 10:28 am
by dourvas
hallo,

i want into a particular page if the user stays more than lets say 20 minutes to automatically load another php page.

More specific i have a page which is a test. The user answears to some multiple choice questions. i want him to have only a particular time to anwear. Lets say after 20 min i want to load the results page.

Any ideas?

Re: load php page after particular time

Posted: Sat Feb 26, 2011 10:54 am
by DigitalMind
I would use JavaScript.

Re: load php page after particular time

Posted: Sat Feb 26, 2011 11:08 am
by dourvas
ok. i thought it would be easier with javascript. Could u be more specific. i do not know to write javascripts. is there a site that offers free code or something similar to that so i could change it according to my needs???

Re: load php page after particular time

Posted: Sat Feb 26, 2011 11:41 am
by DigitalMind
Here is an example

Code: Select all

<html>
<head>
<script type="text/javascript">
<!--
function init() {
	window.setTimeout(redirect, 3000); // 3000 means in 3 seconds
}

function redirect() {
	window.location = 'http://www.google.com/';
}
//-->
</script>
</head>
<body onload="init();">
Some Text
</body>
</html>

Re: load php page after particular time

Posted: Sun Feb 27, 2011 4:49 am
by dourvas
ok thanks for the code. i found excacly what i needed
a digital clock counts down the time and when it reaches 0 it redirects to another page. (with javascripts)

Something else now. How can i set that clock to be always visible on the screen even if scrolling down is happening?

Re: load php page after particular time

Posted: Sun Feb 27, 2011 9:23 am
by DigitalMind
I think you should post your question to viewforum.php?f=13