.guys i'm starting a new project. an online examination using PHP and an online database phpMyAdmin.
.the exam is consisted of questions which can be answered by choosing one of the four answers. what i want to do is either use dropdown menu or multiple radioboxes when picking answers.
of course there should a submit button which when clicked submits the selected answer and checks the database whether it is correct or wrong. after answering all of the questions a result page should be displayed.

.if anybody could guide me on doing this project then it would be much appreciated. thank you in advance!

.please help me as i am only a beginner on using PHP and mySql programming languages.

Recommended Answers

All 7 Replies

This project is not difficult to do. Here are a few tips to get you started.

1. Start out by creating a table with the unique_id, the question, the four options, the question type (Drop Down or MCQ) and the correct answer.

2. Decide on whether the questions will be entered into the database directly or by the user using a form. If it is to be through a form then you have to create a form for putting in these questions.

3. Create the Q&A page. This can be done by looping through your db of questions and echoing the required ones along with the choices on the page, in a form

4. Create the processing script to accept the answers from point 3 and compare them to those in the DB to check the answers and calculate the score.

Start out with the code. If you get stuck, post the problem you are stuck with here. There are several of us who will hep you out and get you on your way.

All the very best.

This project is not difficult to do. Here are a few tips to get you started.

1. Start out by creating a table with the unique_id, the question, the four options, the question type (Drop Down or MCQ) and the correct answer.

2. Decide on whether the questions will be entered into the database directly or by the user using a form. If it is to be through a form then you have to create a form for putting in these questions.

3. Create the Q&A page. This can be done by looping through your db of questions and echoing the required ones along with the choices on the page, in a form

4. Create the processing script to accept the answers from point 3 and compare them to those in the DB to check the answers and calculate the score.

Start out with the code. If you get stuck, post the problem you are stuck with here. There are several of us who will hep you out and get you on your way.

All the very best.

.thanks dude! i think i'm going to start this by creating the quiz page.. what i need to know is how to fill an array with records from a database.

Are you able to connect to the db?

Once you get that, you can use mysql_query to get the data from a table into a recordset. From here, use mysql_fetch_array() to get each record one after the other using a while loop. So the code would look like this

$sql="SELECT * FROM QUESTIONS";
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
   echo $row['question'];
}

The above is just an example. You will need to change the code to suite your application.

.sir why haven't you replied to my previous message?

The easiest way would be assigning the correct answers to some variables, get the user input from a form and compare the input with the correct answers.
if the answer is true then you could add some points ($grade++)

then echo the final score

of course there are better ways to do that.

0nline examination in php and also give the database .question comes randomly and also give the score when the time out

I have done this kind of project earlier. If you need more info please contact me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.