count down timer

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
bhanu
Forum Commoner
Posts: 46
Joined: Thu Nov 05, 2009 4:25 am

count down timer

Post by bhanu »

Hi every one please go through count down timers...
i want to display countdown timer in my site.
I searched so many examples but i did not get what i want.

what i require is :

subject is online exams...

In my site we are conducting an online exam , for this exam i fixed a time 2 hours.
when online user starts a exam time will start to count down h:m:s format. means 1:59:59 .59 seconds.time reached to 00:00:00 .

i want to display countdown timer in top of the question paper . Time left 1:50 :09 sec like this.

It may Javascript or in php script.

let me out from this query...

Regards
bhanu
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: count down timer

Post by buckit »

you'll want to use javascript. you can write a javascript function to update a div with the countdown. will the page reload? if so then you need to specify a time to count down to.

so basically, say I click a button that says "start". that button would trigger some PHP to set a session variable to 2hrs from that time. then supply your javascript with that session end time as well as the current time each time the page loads and have it countdown to that time based on the current time.

now dont make the mistake to use PHP date() to specify the finish time and use javascript to speficy the current time. PHP will pull the server time and javascript will pull the client time and can cause in accurate data.
Post Reply