Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

How can i make a Quiz ( True False and Multiple Choice question) in PHP ?

I want to create few quizzes just like we have here at treehouse. Any ideas on how to start?

3 Answers

Steven Walters
Steven Walters
10,573 Points

This looks like a pretty nice place to start. Let us know what you come up with.

http://css-tricks.com/building-a-simple-quiz/

Thanks Steven for the reply. I already go through that before. Actually what i am trying to develop is a quiz in which all the questions comes one by one. Also all the questions and answers should be fetched from a database. Can you help me in getting logic for that?

Steven Walters
Steven Walters
10,573 Points

Have you done

http://teamtreehouse.com/library/database-foundations

and

http://teamtreehouse.com/library/using-php-with-mysql

Seems like once you have a handle on the database side the rest would be fairly straight forward.

Keep us posted on your progress.

I have stored all the questions and answers in MS SQL database. But the thing is that how can i retrieve them one by one. Also show user if his answer is right or wrong on the spot.

Steven Walters
Steven Walters
10,573 Points

Break it down into simpler steps.

  • lay out how the quiz will be presented to the user
  • present the user with a question from the database
  • let the user give an answer
  • display the results of the answer
  • keep track of the the number of questions/answered correctly
  • display the results to the user

Have a look on github and see if anybody has done anything similar to what you want to do.

Here are a couple that looked interesting to me.

Good luck!