I am working on a Computer Base Test project where user will be tested and graded on selected subject. I have a set of questions with options in the database. I want to be able to display the question in a way the user will be able to select option and navigate the questions. I am using php/mysql.
Here is my question table structure:
question(id,subject,question,optA,optB,optC,optD,answer).
My php code is:
$query = "SELECT * from {$table} WHERE subject={$subj}";
$question_set = mysql_query($query, $connection);.
I know I will need javascript to do this, Pls help me out.
You should send a ajax request to the server to get these data. You can use jquery AJAX for that.
$.ajax({
url: "question.php",
context: document.body
}).done(function(data) {
$('#question').html(data);
});
After getting the questions from the server through AJAX request. You can display the question below the option.
For more info about Jquery Ajax, Refer http://api.jquery.com/jquery.ajax/