load php page after particular time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dourvas
Forum Commoner
Posts: 26
Joined: Fri Dec 05, 2008 7:21 am

load php page after particular time

Post 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?
User avatar
DigitalMind
Forum Contributor
Posts: 152
Joined: Mon Sep 27, 2010 2:27 am
Location: Ukraine, Kharkov

Re: load php page after particular time

Post by DigitalMind »

I would use JavaScript.
dourvas
Forum Commoner
Posts: 26
Joined: Fri Dec 05, 2008 7:21 am

Re: load php page after particular time

Post 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???
User avatar
DigitalMind
Forum Contributor
Posts: 152
Joined: Mon Sep 27, 2010 2:27 am
Location: Ukraine, Kharkov

Re: load php page after particular time

Post 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>
dourvas
Forum Commoner
Posts: 26
Joined: Fri Dec 05, 2008 7:21 am

Re: load php page after particular time

Post 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?
User avatar
DigitalMind
Forum Contributor
Posts: 152
Joined: Mon Sep 27, 2010 2:27 am
Location: Ukraine, Kharkov

Re: load php page after particular time

Post by DigitalMind »

I think you should post your question to viewforum.php?f=13
Post Reply