Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

In this tutorial i had some of new features to the quiz application comparing previous one (Quiz application Using PHP, jQuery, Ajax, MySQL and HTML5). Following features are added

1. This Quiz application is responsive one, it will automatically render in desktop, mobile and tablet based on screen size and resolution.

2. This application has both previous and next button functionality.

3. For demo purpose I added user simple user registration.

4. User can choose category when they going to start an Quiz application.

5. Finally user score will be saved in database.

Note: Once you completed this tutorial.please refer part-2 of this tutorial(Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap part-2)

This is very simple application, please follow the this tutorial at the end you can make it yourself.

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Demo

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Step 1: Create following three tables

1. users

2. categories

3. questions

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Download

using following sql queries.

Now add the following sample data’s in it.

Here is the sample database relational daigram of above three tables.

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Step 2:

Create config.php file to keep database connection in a separte file.

Step 3:

Create index.php file and the following scripts in it, which take care user registration process.

Step 4:

Now create check_name.php file which take care unique name check in the database while user registring.

Step 5:

Now create question.php and add following scripts. This is main file  of this quiz application which gets questions randomily from database for each the user. As well it take care previous and next button functionality using jQuery.

Step 6:

Finally create result.php file and add the following lines of script in it.

Step 7:

Finally create logout.php file which take care user logout process as well it redirects the user to index page.

Posted by:

muni
  • murugan

    thanks. however it is not working if the data records exceed more than 10? Could be due to fixation of random number for the range from 0 to 9. Or have you restricted the number of records to 10 and if so in which file?

    murugan

    • muni

      Hi,

      Thanks Murugan,

      once I fixed, I will leave you comments here………

      Regards,
      muni

      • muni

        now it fixed.

        please download latest code.

        Regards,

        muni

  • murugan

    Great. Now it is working. Thank you very much. I will check the latest code and find where it went wrong.
    Once again I thank you for your guidance.

    murugan

    • muni

      Welcome Murugan.

      Regards,

      muni

  • http://www.livepositiveway.com Jagan

    Dear Muni,
    Your work is great & it’s helping plenty of programmers.
    But I asked assistance for something from you that you’d probably remember… There’s not even one in that list that is capable for writing tutorial ?

    • muni

      Sure Jagan..

      I will…

      muni

  • naveen

    i want be a full quiz coding with timer…

    also a website is very useful

  • Okezie Micael

    Nice, Good work. wishing you more knowledge and Grace.

    Please how do i add a timer to it ?

  • Muthu

    nice website, thanks for sharing your code, please share with source code with category selection

    • muni

      Sure … i will do it and share…..

  • mile

    hey muni, how to dont use ajax in mean not show question if touch CTRL+U
    I mean more safe if use session, right? how show from database with random question+answer and know what question was answered.

  • Luis

    very good project, congratulations, greetings from Mexico, my English is not very good, but I wonder how it could save your responses in bsade data’m somewhat novice in web development, agradececia much any suggestions of yours, I hope you can help me .

    In advance thank you very much.

  • Tusar

    Hi Muni. In a situation, where I have to show checkboxes instead of radio buttons for teh answer options, where user can select multiple answers. I have stored the answers in the db as comma separated value. How do i validate the serialize data. Can you please suggest.

    Yhanks

  • Vitor Sousa

    Hi :::I still have no answer about css files sorry…

    Thanks

  • Vitor Sousa

    You give us a path like this in questions.php

    …But where are the files?…

    “”

    The next buton apears in all page and doesn’t work:::

    How can i fix it?

    Thank you:::

  • Vitor Sousa

    sorry i was talking about this files
    css/bootstrap.min.css” rel=”stylesheet” media=”screen
    css/style.css” rel=”stylesheet” media=”screen

    “js/jquery-1.10.2.min.js

    js/bootstrap.min.js
    script src=”js/jquery.validate.min.js

    • muni

      Hi Vitor,

      I had provided all the source files in the downloaded link. Please find the download button at the start of tutorial and download all the source files….

      Many Thanks,
      muni

  • http://www.grecenter.net/model_test/ omar faruque

    Dear Bro,
    Thanks a lot for this type of tutorial. But I have a problem. If you fix my problem. This is my file link: http://www.grecenter.net/model_tesst/

    When i click “next” then come “next-2″ question but after 9th question they show 2 “container div” at a time. i meen number 10th & number-1 show at time. In this position what can i do?

    Thanks
    Omar Faruque
    Bangladesh.

    • http://dreamlib.vn nguyenquocuy

      Can you send me the source code, please!

      • muni

        Sent :-)

  • http://v.youku.com/v_show/id_XNTUwODk5Nzg4.html 七彩神仙鱼

    Great article.

  • http://tinyurl.com/np32dll drukarnia

    After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on whenever a
    comment is added I get four emails with the same comment.

    Perhaps there is a way you can remove me from that
    service? Thanks a lot!

  • Layla

    I’ve tried to download the source file but it didn’t work.
    I subscribed with 2 emails and I didn’t get the download link
    I need the css files please

  • http://dreamlib.vn nguyenquocuy

    Send me source file please. I did subscribe, but no download link has been sent to me. Thank you so much, very nice quiz!

  • vipin

    I subscribed but still dn’t get the download link

    • muni

      Sent :-)

  • Vishwanath

    I need to know how may written online exam on a particular date..

    please send me code for this

  • Her

    Hi Muni! For me the questions are all appearing in the same page.
    How do I make only one question appear in the page?

  • https://www.youtube.com/watch?v=yjx-LlQUbKg unlock iphone ios 8

    It’s an awesome post in favor of all the web people; they will take advantage from it
    I am sure.

  • Filipe

    I subscribed but still don’t get the download link =(

  • David

    Hello, thanks for this tutorial, i’m starting to learn how to code and i have some problem making this tutorial.
    can u send me the complete source code?

    thanks

  • Cristian

    Hi muni! Can you please send me through email the source code please? I’m already subscribed and can’t get your mail with the code automatically

  • Rodrigo

    In this example there is the possibility of adding new questions? If so, how?

  • http://stanleytips.com Cristian

    Hello! I there any simple way to display the list of questions and answers on the results page? I mean I want to display all the questions with selected answers and correct answers! Important for users to reviews answered questions:).

    Thank you

  • megu

    thank for the great tutorial! :D it would be a big help

  • Rodrigo

    Good morning this example when I create a User and beginning to play the quiz. Now when do i get out of this User session and try to put your credential accuses the system that already has a registered User and not play the quiz

    • muni

      will add this functionality soon

      Thank you :-)

  • Domy

    i cant check the comments after login. What can be the problem? Can you please tell me to make code work for more than 10 questions?

    • http://smarttutorials.net/ muni

      Pls refer following tutorial it fixed issue to display more than 10 questions…

      • Domy

        Thank You so much….i really appreciate your help….keep on posting tutorials..will be following you…thank you again!!

        • http://smarttutorials.net/ muni

          :-)

Related articles

My Favorite Blog

Quiz Web App

Responsive Quiz Application Using PHP, MySQL, jQuery, Ajax and Twitter Bootstrap

Be Happy!!!

Inspirational Quotes - Motivational Quotes- Short Stories

Does God Exists?

Inspirational Quotes - Motivational Quotes- Short Stories

Back to Top