Page 1 of 1

PHP for use creating a test

Posted: Sat Feb 21, 2009 8:01 pm
by fblair
I want to make a web based test. Each test has 50 multiple choice questions with four possible answers.

I would like to use radio buttons for the possible answers and then keep count of which questions have been answered in an array.

The database will have the text of the questions and the text of the possible answers and the correct answer. When the student clicks on a button I can record his answer in the array. When he wants to be scored then I can scan the array and check against the correct answers to calculate a score.

Am I going in the right direction?

Thanks,
Fred :roll:

Re: PHP for use creating a test

Posted: Sun Feb 22, 2009 8:19 am
by mad_phpq
are all the questions on one page?

Re: PHP for use creating a test

Posted: Sun Feb 22, 2009 9:05 am
by fblair
What I was thinking about was basic page layout, then when the student chooses to go to question 2, the page would reload with new question and possible answers. That means that the array would have to be accessable from all pages and when you are responding to question 2, it would have to know to place the answer into the correct position in the array.

I want to have all the questions, etc. stored in MySQL and pull them in as needed. I was also thinking about loading all 50 questions in the beginning and loading them into variables or arrays and then just displaying them when needed.

Re: PHP for use creating a test

Posted: Sun Feb 22, 2009 4:38 pm
by php_east
hi,

i happen to cross this road before. the good news is that there is a ready made solution for it, so no need to reinvent the wheel i think, in this case.

there is a nice component with all the features you mention an even more
for the price of about 80 dollars, ( which i think is well worth it , considering the amount of time saved by having such a capability, especially for schools ).
It runs on Joomla CMS, Joomla itself is open source and free ( well, just in case you didn't already know).

i however did not take up this nice peice of software, as i did not have the people to manage and run the quiz site i wanted to make, i hence scrapped the project. But i did do a short study and evaluation of it so am in the know of what it can do.

Let know if you are interested, and if there is a large interest such a solution, if there is a large interest, maybe post here as well.

which brings me to another related topic, if there are people intersted in running a quiz site, please give us a holler. i still think a quiz site is a good one to make and can provide good revenue, even if for non-profit. i can build one but not maintain it.

many thanks.

Re: PHP for use creating a test

Posted: Sun Feb 22, 2009 9:01 pm
by fblair
I will need to work on it myself, this if for a small flying club and there are only 6 tests.

I need to keep my brain working to keep from getting old.

:lol:

Re: PHP for use creating a test

Posted: Sun Feb 22, 2009 11:03 pm
by php_east
which would actually be even better.

only that i am a little confused when u says "when he wants to be scored".
how many chances does one get to be scored ?
can he check his score so far, and come back and do the rest ?

just some thoughts.

Re: PHP for use creating a test

Posted: Mon Feb 23, 2009 5:45 am
by fblair
My idea is to only score once. If you could continue to self-score, you could keep changing the multiple choice questions until you go them right.

Fred :roll:

Re: PHP for use creating a test

Posted: Fri Feb 27, 2009 5:39 pm
by php_east
all the best then.

i would actually use objects, questions being one and answers being another.
you would then endup with if ($questions==$answers) which would be rather a convenient
way to check for correct answers.

i'd be glad to help. just ring.

Re: PHP for use creating a test

Posted: Sat Feb 28, 2009 10:29 pm
by josh
To expand on php_east, I would have subclasses of each type of question ( one for multi-choice, etc.. etc.. ). I would then have a test object that held a collection of it's questions. I could ask the test object if it were valid and it would ask all of it's children, if all of it's children were valid it would return true. This is called the composite pattern. Basically you define an interface each class implements, so each class has a ->isValid() method. To expand on this further you could have a test composite other tests ( sub-tests ). Validate ranges of questions at a time ( multi-page forms ), etc..

Re: PHP for use creating a test

Posted: Sun Mar 01, 2009 7:45 am
by fblair
Thanks for all the ideas, I have much more to learn to begin to comprehend the answers that have been given.

:lol: