in reply to Simple Quiz Maker
#!/usr/bin/perl -w use strict; use CGI qw(:standard); my @which = qw/ first second third fourth fifth /; my @WHICH = qw/ First Second Third Fourth Fifth /; print header, start_html("Quiz Maker"), h1("Quiz Maker"); if (param()) { my $who = param("firstname"); my $who2 = param("lastname"); my $email = param("email"); my @questions = map { param("$WHICH[$_]Question") } 0..4; my @answers = map { param("Answer$WHICH[$_]Question") } 0..4; #my @user_answers = ... # you get the picture #my @choices = ... print p("Thank You. Here is your quiz:"); print p("Name: $who $who2"); for (0..4) { print hr(), start_form(); print p("Question #". $_+1 .": $questions[$_]"); print p("Answer:", textfield("UserAnswer$WHICH[$_]Question")); } } else { print hr(), start_form(); print p("What's your first name?", textfield("firstname")); print p("What's your last name?", textfield("lastname")); print p("Enter your e- mail address", textfield("email")); for (0..4) { print hr(), start_form(); print p("What is your $which[$_] question", textfield("$WHICH[ +$_]Question")); print p("Please enter the answer", textfield("Answer$WHICH[$_] +Question")); } print hr(), start_form(); print p(submit("Submit"), reset("Reset")); print end_form(), hr(); } print end_html;
|
|---|