473,379 Members | 1,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

countdown timer question

nomad
664 Expert 512MB
Hello everyone again:
Ok I figured out the quiz section and now I need to but a timer on the test.
if anyone knows how to do a countdown timer that will only lasts for 30mins(or what ever time) for a test? Like when I click a 'start test' button, the timer will operate by itself and when it hits 30mins, the test session will end by itself and the students will just have to press on a submit button for their scores.

thanks
nomad
Mar 13 '08 #1
9 3362
satas
82
Hello everyone again:
Ok I figured out the quiz section and now I need to but a timer on the test.
if anyone knows how to do a countdown timer that will only lasts for 30mins(or what ever time) for a test? Like when I click a 'start test' button, the timer will operate by itself and when it hits 30mins, the test session will end by itself and the students will just have to press on a submit button for their scores.

thanks
nomad
It is possible to have a table in the database. When the student begin the quiz new row appears. In that row you should store time when the quiz was started and quiz ID. During the test script will has to compare current time with time in the row using ID.

Good luck!
Mar 14 '08 #2
ronverdonk
4,258 Expert 4TB
It is possible to have a table in the database. When the student begin the quiz new row appears. In that row you should store time when the quiz was started and quiz ID. During the test script will has to compare current time with time in the row using ID.

Good luck!
That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.

No, you have to use client code like JavaScript to run this. Luckily there are numerous count down timers to be found on the web. Just google for it. One simple one can be found countdown timer

Ronald
Mar 14 '08 #3
satas
82
That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.
But it is php forum. I've just wrote method how to orginize server-side logic for this.
Thread starter should decide how to implement it in users browser.
I think the best way is to use AJAX and perform query to the server every 10 seconds.
Mar 14 '08 #4
ronverdonk
4,258 Expert 4TB
You cannot escape using JavaScript for this. This may be the PHP forum but even a server side language cannot perform client side operations. Ajax is only a way of using server side code with client side code via the HTTP path.

A real-time countdown timer can only be written in client side code. And a timer like this is straight forward and costs no more than approx. 10 statements. Using extra PHP for this is just make up.

Ronald
Mar 14 '08 #5
satas
82
Yeah, nothing to add. You're absolutely right.
Mar 14 '08 #6
nomad
664 Expert 512MB
That is not a countdown timer: it does not count down, but just compare 2 time values only when the user does something that triggers the SERVER code to be executed.

When the user just stays within his client environment, it never runs. So for an exam, the sutdent could stay within his form for 24 hours doing nothing and looking up the answers before filling in and submiiting and triggering server code to be run.

No, you have to use client code like JavaScript to run this. Luckily there are numerous count down timers to be found on the web. Just google for it. One simple one can be found countdown timer

Ronald
Thanks Ronald...
Didn't even think of using javascript

damon
Mar 14 '08 #7
ronverdonk
4,258 Expert 4TB
Thanks Ronald...
Didn't even think of using javascript

damon
Yeah, despite being in the PHP forum, we sometimes have to use a 'lesser' (sorry JS adapts) language because it suits us.

Ronald
Mar 14 '08 #8
nomad
664 Expert 512MB
Yeah, despite being in the PHP forum, we sometimes have to use a 'lesser' (sorry JS adapts) language because it suits us.

Ronald

You're still up when do you sleep?
Dedicated person here.
nomad
Mar 14 '08 #9
ronverdonk
4,258 Expert 4TB
You're still up when do you sleep?
Dedicated person here.
nomad
I usually sleep from about 2am to 10am, which is about 9 hours from now (Dutch standard time).

Ronald
Mar 14 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bonnett | last post by:
I have been creating a generic countdown timer (source code below), counting the seconds, minutes, hours and days till an event, but I have having trouble with it finding out how many hours are...
4
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually...
8
by: Michael | last post by:
I have this script that works the way I want except for one thing... Once it hits zero it starts to count up and looks like this: -1:0-1:0-1:0-18 with the last number counting up. Can anyone...
1
by: Will | last post by:
I have form showing instructions and logging actions and I would like the form to show a count down timer for a certain period of time. E.g. 30 secs, going down to 0 and then displaying the action....
3
by: JimJam | last post by:
Hello Peeps I have created a program in VB.NET 2003 that counts down from 7.5 hours to zero from 08:00. I have a button that starts a new countdown from 1 hour to zero whilst the first one is...
1
by: Dirk Hagemann | last post by:
Hi! I'd like to implement a countdown timer on a webite. It should show the months, days, hours, minutes and seconds until a given date and time. So far it's not really difficult, but this...
9
by: MC | last post by:
I would like to display a timer in the corner of the page that shows the user how many minutes:seconds till the session times out. Are there any good examples out there? Google has again failed...
5
mageswar005
by: mageswar005 | last post by:
hi, I need a javascript countdown timer to my website, I have already the countdown timer but its have some problem. Note: 1) If i choose the tools/internet option in my browser means , at...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.