quizmaster.pl: OVERVIEW AND Usage


Quizmaster.pl is really a very simple script. To use it, all you have to do is write a HTML form where each NAME element and each VALUE element follow some basic rules. Quizmaster.pl looks for filenames that you put in the code of your HTML form, and displays different files depending on the selection of the user (e.g., one file for a correct answer, one for an incorrect answer). If several questions are asked, several files can be displayed, concatenated together. Because all of the files displayed are written by you in HTML, you can add pictures and links as appropriate.

Here are the rules you must follow when writing your form:

1. The first VALUE element must be a special path

Quizmaster.pl needs to know where your quiz files are kept. These files contain the results that quizmaster.pl displays to the user depending on which answer(s) the user chooses on your quiz form. The first VALUE element in your quiz form must contain a partial path to the directory where your quiz files are kept, in the format:

(your user id)/public_html/(the rest of the path)

For example, if I created a directory from my public_html directory called "quiz1" that contained the quiz files, the first VALUE element of my quiz form might be "jsmith/public_html/quiz1".

2. The other VALUE elements must be filenames from that path

The remaining VALUE elements in your quiz form should be names of HTML files in the directory you specified with the first, special VALUE element. These files will be displayed by quizmaster.pl depending on the answer chosen by the user from your quiz form.

If I had two files, "rightanswer.html" and "wronganswer.html" in my quiz directory, two of my VALUE elements might be "rightanswer.html" and "wronganswer.html".

3. Put basic HTML in your quiz files

Quizmaster.pl does not add basic HTML elements such as <HTML>, <HEAD>, and <BODY> at any point. These tags have to be in the HTML files you specify in the VALUE elements of your quiz form. If your quiz form returns multiple files, be sure the first file has be beginning elements and the last file has the ending elements, or use a header and footer file.

4. NAME elements must be ordered

Quizmaster.pl sorts all of the elements you give it alphabetically and numerically, so each NAME element must be ordered sequentially in the order you wish the script to process that element. For example, the first element might be "1" and the second might be "2". Alternately, the first element might be "a" and the second might be "b".

The ordering of elements is useful when you want all of your quiz results to have the same header and footer. You can specify two form elements (one for the header, one for the footer) anywhere in the quiz form, and if the header element is first sequentially (e.g., "0001") and the footer element is last sequentially (e.g., "9999") then they will be displayed first and last, respectively.

Go back to DCN Web Tools: quizmaster.pl

quizmaster.pl was written by Christian Sandvig. If you are interested, the source code is available.