Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:31:10+00:00 2026-05-24T04:31:10+00:00

I am a bit new to php and I need to create a quiz

  • 0

I am a bit new to php and I need to create a quiz website. I have been searching a lot but I couldn’t find the exact code that I need.

On the first page, the user will see questions, answers and he can choose answers by clicking radio buttons. Once submitted, I want to compare on the next page 2 arrays of answers (user answers and the correct answers).

The correct answers array may look like this:
$res1 = array(b,a,b,c,b,d,a,b,c,b);
I believe I should use “for” or “for each” but I don’t know how to write it.

The next step will be incrementing the quiz score in case the compared values are equal (user choice: b and correct answer: b)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:31:11+00:00Added an answer on May 24, 2026 at 4:31 am

    Here is a simple solution for you:

    First, create a form like this:

    <form>
    <input type="radio" name="question_1" value="a" />
    <input type="radio" name="question_1" value="b" />
    <input type="radio" name="question_1" value="c" />
    
    <input type="radio" name="question_2" value="a" />
    <input type="radio" name="question_2" value="b" />
    <input type="radio" name="question_2" value="c" />
    ...
    </form>
    

    In php, do something like this:

    $answers = array('a', 'b', 'c', 'a', ...);
    $points  = 0;
    
    for($i=0; $i < count($answers); $i++) {
        if (isset($_REQUEST['question_'.($i+1)]) && $_REQUEST['question_'.($i+1)] == $answers[$i]) 
            $points++;
    }
    
    echo $points;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've done a fair bit of mysql php programming but am pretty new to
I am a bit new to sql and php so I need some help
Hello new to PHP and in a bit of a bind. I need to
I am new to Java (but have a fair bit of .NET experience). I
I am new to php and trying to write a login function. Bit stuck
I am a bit new to Perl, but here is what I want to
I'm a bit new to .Net development, been working in Java for some time
I'm a bit new to SQL and have trouble constructing a select statement. I
This question may seem a bit stupid, but i'm new to Joomla! And i
I am facing a bit of a quandary, I need to replace a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.