Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


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.


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




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!