0

It can be implemented as an online examination system. And yes the display of the answers should be displayed as u have mentioned before. that is:

In my Question Number 1 your answer is... Choice number 2
In my Question Number 2 your answer is... Choice number 1

and gives the score.

My problem was implementing the same using the arrays.

0

No i dont have a file or a database of the correct answers. i was opting to use just the answers...

0

go back to previous page where you loop the select tag for answers, right now back track the loops of questions and place inside the label tag with the name="questions_array[]" and the value='".$v['questions']."'
so it will look like this
echo "<label name='questions_array[]' value='".$v['questions']."'>".$v['questions']."</label></br/>";

0

after what I had mentioned before this.
do the same thing of printing the array using print_r and check again if there's no error just like what you did in print_r($_POST['selected_answers']);
now do this also
print_r($_POST['questions_array']);
trigger it and see if the correct questions are also passed down to processor.php

0

when I try to run my code after doing that it erases my questions and displays only the answers on the browser.

0

ohh so I got it. there's no error on that but label tag does not support on passing down it's content. Kindly stay tuned for about 2 hours. because I'm off now at work and see you later after 2 hrs

0

After inserting the codes it only displays:

Array ( [0] => risk management [1] => control coupling [2] => beta testing [3] => Stress testing [4] => Stress testing [5] => Achieng ) 
0

I hope tomorrow we continue with the coding. This is where we left:

<?php
//If we submitted the form
if (isset($_POST['submit']))
{
print_r($_POST['selected_answers']);
}
?>

Was suppose to accomplish:

Its task will be to check the answers chosen, among them there is one correct one and others are wrong. Processor.php should compute by adding one for each correct answer and adding zero for the wrong answers and at the end give out the verdict out of the total number of questions. Thank you once again.

0

I'm sorry I havent got back as what I've said yesterday. Dont use label on your previous page because it will not pass down the content.

first on your previous page ( before the process.php )

place this css tag down below the opening head tag

<style>
#text_disabled{
border:none;
font-size:10pt;
color:black;
}
</style>

now after placing the style replace the label tag with
Last name: <input id='text_disabled' type='text' value='".$v['question']."' name='questions[]' disabled>
you see there was 'disabled' on the part of the text box, meaning cannot be edited. so in this manner value attribute is the one that automates to insert the question to the question[] you dont have to enter the values anymore.

then on your process.php you can now proceed by print_r($_POST['questions']); and now you can be able to pass it on

0

I have tried to do as u have said it works so well but there are problems with the display when i run the codes:

1) The questions are being overllaped by the pull down menu for answers such that some parts of the questions cannot be viewed.
2) processor.php doesn't display the questions as u have said.

Thanks you.

0

I have managed to solve the overlapping elements of questions and answers:
Now what remains is that the processor.php does not display the questions as u had said.
thank you.

0

Hi it's been a couple of hours

kindly lrtme know where your print_r($_POST['questions']) was coded and run it once more.

0

It was coded in the following manner in the processor.php

<?php
print_r($_POST['questions']);
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.