Client Liaison Manager, Asia, m62 visualcommunications
Sending Quiz Results to Server
In this article we’ll describe how to configure a quiz to send results to a server and how to write a server-side script to collect the sent values.
Prerequisites
- You must have permissions to create a script on your server and to access your database. Or you may address your system administrator for help.
- You must have a working knowledge of some server-side programming language, for example, PHP or any other language.
Quiz Settings
First of all, you should configure your quiz to send results to a server.
- Open your quiz or create a new one.
- Click the Settings button on the QuizMaker toolbar.
- Open the Result tab.
- Select the Send quiz result to server checkbox.

- Specify the web address of the script that will process quiz results.
The script itself will be described below. - Publish your quiz.
Now your quiz will send results to your server script.
PHP Script
The next step is to write a script that will process quiz results and deploy it on your server at the address you specified in the quiz settings.
Quizzes generated with iSpring QuizMaker send results using the POST method. The table below contains all POST variables that a quiz sends.
| Variable | Description |
| v | QuizMaker version |
| dr | Detailed results in .xml format complying with the schema below |
| sp | Earned points |
| ps | Passing score |
| psp | Passing score in percent, that is how much of a total score in percent a user must gain to pass a quiz |
| tp | Gained score |
| sn | Quiztaker's username |
| se | Quiztaker's email address |
| qt | Quiz title |
Note: QuizMaker will send either ps or psp. This depends on the Passing Score option (Quiz Settings -> Main). If it’s specified in points, the program will send ps; if in percentage – psp.
So in order to receive these variables, you need to write a script and deploy it on your server.
Here is a sample PHP script that receives the POST data and writes them to a file. This is just an example; you will certainly want to use a database to store the results. But this script does its job: it shows how to get the POST data sent from a quiz.
Let’s analyze this script.
These PHP lines collect the POST values sent from a quiz:
$version = $_POST['v'];
$points = $_POST['sp'];
$passing_percent = $_POST['psp'];
$gained_score = $_POST['tp'];
$username = $_POST['sn'];
$email = $_POST['se'];
$quiz_title = $_POST['qt'];
$_POST is an associative array of variables passed to the current script via the HTTP POST method. So all you need is to address necessary variables (listed in the table above).
The second part of the script simply writes the obtained data to a text file (results.txt). This is just an example; a real script will most certainly work with a database to store results.
Detailed Report
What if you want to get detailed results? In this case you will need to use $_POST['dr']. This variable will return an xml file with detailed results.
Here is the XML schema that describes the structure of this XML document.
$detailed_results_xml = $_POST['dr'];
Then you will just parse the xml file.
I answered some questions from the US Country Study quiz and got the following xml report.
For example, the multiple response question about the Yellowstone park:
Creating a question in iSpring QuizMaker:

Question in a Flash quiz created with iSpring QuizMaker:

Here is the xml output from the detailed results:
<quiz>
... <questions> ... <multipleResponseQuestion awardedPoints="10" usedAttempts="1" status="correct" maxPoints="10" maxAttempts="1"> <direction>Yellowstone, the oldest American national park, is located in three of the following states (Tick the names of three states): </direction> <answers> <answer selected="true" correct="true">Wyoming</answer> <answer selected="false" correct="false">Indiana</answer> <answer selected="true" correct="true">Idaho</answer> <answer selected="true" correct="true">Montana</answer> </answers> </multipleResponseQuestion> ... </questions> </quiz>
Question type is Multiple Response. The attributes of the element provide the summary of the given question: a number of used attempts, maximum number of attempts allowed, the question status (correct or incorrect), the maximum points a user can get for the correct answer and the actual points awarded.
In our case the user answered this question correctly (status="correct") using only one attempt (usedAttempts="1") out of one (maxAttempts="1") and got 10 points for it (awardedPoints="10") out of 10 (maxPoints="10").
The detailed information about the user’s answer is described by the element. As you can see, the user selected all correct options (Wyoming, Idaho, and Montana) and left the wrong option (Indiana) unselected.
e.g. Wyoming
The user selected Wyoming (selected="true"), which was a correct answer (correct="true")
Note that the xml representation differs for different question types. So you should look up the xml schema for details.