Creating a timed test in PHP?

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
skallsen
Forum Newbie
Posts: 1
Joined: Sat Nov 18, 2006 3:15 pm

Creating a timed test in PHP?

Post by skallsen »

I'm new to PHP and need to create a timed test. Well, maybe two timed tests: 1) keeps track how long someone takes to complete test and 2) a test that is timed and closes after a certain amount of time.

Number 1 is the one I need most urgently - does anyone know of a tutorial for something like that? Or where I could get some code to learn from and change variables to meet my needs?

Thanks much!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Store the starting time in the database when you issue the test (be sure to give an ID too), and compare that with the ending time when the user submits the test. Works for both requirements.

If you want, some client-side JavaScript could be used to give the user realtime notification of their time left.
Post Reply