#!/usr/bin/perl require "cgi-lib.pl"; MAIN: { if (&ReadParse(*input)) {&ProcessForm;} else {&ShowForm;} } sub ShowForm { # Contains option to display form print &PrintHeader; print < Survey of Driving Values

A Survey of Driving Values

Values, in the context of this exercise, are those external influences in your life, often instilled in you by your parents, school, and community, that affect the way in which you make decisions. This exercise is intended to determine the primary influences on the lives of students in this class and to set the stage for our further discussions during the course of the semester. From the following list of "driving values", choose the five that you believe most affect they way in which you make decisions. If you want a dictionary definition of a term, click on the term itself first.

Career
Compassion/Tolerance
Determination
Education
Fairness
Family
Friendship
Happiness
Health
Honesty
Integrity
Justice
Love
Loyalty/Patriotism
Religion
Respect
Responsibilities
Self-Esteem/Self-Respect
Success/Winning
Trust
Other

Enter your name:
Password:    

STUFF print &HtmlBot; } #end ShowForm sub ProcessForm {#Respond with a thank you #Check password $password = "babbage"; if ($input{"pwd"} eq $password){ $randnum = int(rand(2000)); print &PrintHeader; print < Survey of Driving Values

Survey of Driving Values

Thank you for your input. We will discuss the results in class.

STUFF2 print "$input{'WHO'}

Your Confirmation Number is ",$randnum; print "

Print this page and bring to the next class.

"; #5 Choices are in associative array "input" #read in stored results so far open(sfile, ""; @answers = split(/ /,$sofar); # print "answers = ",@answers, "

"; close(sfile); #check results so far #for ($j = 1; $j < 22; $j++){ # print "v",$j," = ", $input{"v$j"},"

"; # print "answer[$j] = ", $answers[$j],"

" # }; #end for #reopen file for output open(sfile, ">values"); for ($i = 1; $i < 22; $i++){ if ($input{"v$i"}!= "") { #v$i is not null, must be a choice, increment answers $answers[$i]++; # print "answer[$i] = ", $answers[$i],"

" } #end if }; #end for #store results print(sfile " "); for ($k=1; $k<22; $k++){ print(sfile $answers[$k]); print(sfile " ")} # end for close(sfile); print <Click here to see the summary of the results

STUFF3 print &HtmlBot} #end password OK else { print &PrintHeader; print < Survey of Driving Values

Survey of Driving Values

The PASSWORD is INCORRECT
and your opinion has NOT been recorded.
.

STUFF4 print &HtmlBot } # end else } #end ProcessForm