Davis Home Events Living Education Business Organizations Forums Government Davis Community Network

quizmaster.pl: STEP BY Step Directions

The links to form elements in these step-by-step instructions point to Carlos' Forms Tutorial. You may want to take a look at Carlos' quick reference if you are a little rusty on forms.

Now let's get started! To use quizmaster.pl to create and implement a quiz from your DCN web pages, all you have to do is the following three steps:

1. Create a directory for your quiz

From the UNIX prompt of your DCN account, create a new subdirectory under your public_html directory that will hold the HTML files associated with this quiz.

First, login to wheel. Next, get to the UNIX prompt. Then, change directories to your public_html directory by typing:

cd public_html

Once you are there, create the new directory for the quiz with the mkdir command. If you wanted to call your new directory "firstquiz" you might type:

mkdir firstquiz

2. Write your quiz form

Create a HTML file using your favorite editor and your own personal style for your quiz. In the file, put a form that uses the POST method and refers to quizmaster.pl with the ACTION element. The beginning tag of your form should look like this:

<FORM METHOD="POST" ACTION="/cgi-bin/quizmaster.pl">

The first VALUE element passed from your form (as explained in the overview) needs to be the partial path to your quiz directory. Since you don't want the user to see this part, you should use a hidden form element. Since this is the first thing we want to go to the script, we should number the NAME element "1".

<INPUT TYPE="HIDDEN" NAME="1" VALUE="jsmith/public_html/firstquiz">

Next, let's ask our question. You can use checkboxes, select boxes, scrolled lists, and radio buttons with quizmaster.pl. For this example, we will use a radio button question. Since this is the second thing passed to the script, we'll number the NAME element "2". Note that each radio button tag will be numbered the same because only the one selected by the user will be passed to the script.

What is two plus two?<BR>
<INPUT TYPE="RADIO" NAME="2" VALUE="right.html"> 4<BR>
<INPUT TYPE="RADIO" NAME="2" VALUE="wrong.html"> 5<BR>

Notice the VALUE elements we used. These will be explained a little later. Last, we need to end our form with reset and submit buttons. The end of our form might look like this:


3. Write the results you want displayed

Remember the VALUE elements we used? We were specifying the filenames of the files to be displayed by quizmaster.pl depending on the answer selected by the user. Now, we need to create those files and put them in the directory we created and specified in our form.

For example, the file "wrong.html" (which would be displayed if a user of our form chose three or five) might look like this if you were a minimalist:

<TITLE>Your Quiz Results</TITLE>
Your answer was incorrect! Please use the BACK function of your browser to try again.<P>

We also would need to create a file like this called "right.html". Be sure these files are readable by anyone, and are in the directory you created in step 1 and specified in step 2 (for this example, the directory was firstquiz).

That's all! We've created a working quiz using quizmaster.pl! Whenever you create a quiz with quizmaster.pl be sure to test it yourself before making it public, to make sure you didn't make any errors in spelling the filenames, or some other mistake.

Examples of the files we might have created in these step-by-step instructions are available on the examples page.

Go back to DCN Web Tools: quizmaster.pl

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

Homepage | Contact DCN | Contact DCN Web Team

Copyright © 1996-2005 The Davis Community Network
URL: http://www.dcn.davis.ca.us/tools/quizmaster/steps.html
Last Revised: December 29, 1996