PHP/MySQL Based Quiz

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
Foundation
Forum Newbie
Posts: 13
Joined: Mon Mar 24, 2003 9:06 pm

PHP/MySQL Based Quiz

Post by Foundation »

Here's my project:

I want to put together a PHP/MySQL based quiz that scores the results, writes them to a database based on their firstName and lastName entries, and emails the results to an admin.

The features I need include:
If they take the quiz once, they can't take it again and overwrite their previous score.
If they miss a question, the results page will tell them the correct answer in red. If they get it right, the answer is in black.

The problem I have is that I'm a PHP novice and when I use setcookie() to keep them from going back, they can override it by clearing cookies. Also, I tried setting the cookie and checking for it on the same page but since it gets created before it's checked, it shows as being present everytime.

I have created a basic system that scores the quiz and gives them the result, but I can't get the function to work for db writing or to keep them from redoing the quiz.

Any help would be greatly appreciated.

Thanks!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you might use sessions and/or the database to maintain the quiz's state.
Although sessions (by default) use cookies, too, the user does not benefit from changing the value.
Foundation
Forum Newbie
Posts: 13
Joined: Mon Mar 24, 2003 9:06 pm

Post by Foundation »

I'll try the sessions approach today and see how that goes.

Thanks for the tip.
Post Reply