I need a script that will help me generate a test. I have a few questions and I must be able to add a few answers. People will choose their answer and after submit the script should send the report (correct vs wrong). Is there a script like this? Or do you know a place where I can get an idea on how to start coding it?
You could go as simple as a form and handler, or you could go as complex as an interactive database that lets you add new questions and answers as an administrator, remembers who gave what answers and does ranking or whatever you want. Sounds like you want the simpler solution. The first step is to make an HTML form that asks the questions. Use something like name=answer[] to put the answers in an array. The action of your Test form would be the handler (Use Post method). In the handler you would have an array of answers and access the visitors answers like: <?php $answer_key=array('a','c','a','b','d','c','b','a','c','a','d','d','c','b'); $answer=$_POST['answer']; ?> PHP: (Or replace the letters with whatever the correct answer would be.) Then you'd compare $answer[x] and $answer_key[x] to see if they match. Then you could echo the results or use the php mail() function to send yourself a report.
I need to generate a random list of 10 questions, from a database. Those questions can have one or more correct answers. After they submit the form I want to return the number of the correct answers and highlight the errors. It is a bit more complex then what you have suggested. Do you have any idea how can I start coding what I need?
Check MultiWebQuiz @ http://www.multiwebvista.com/testzone/download.php. It appears to have the features you are looking for in a script. It is a bit dated, but it might help you get started with your effort. Also, check HotScripts @ http://www.hotscripts.com/category/php/scripts-programs/tests-quizzes/