in reply to Simple Quiz Maker (cont.)

Since the internet is a stateless environment, you need some way of maintaining state.

The options I see for you are:
  1. Pass all answers through the whole app, using hidden fields.
  2. Drop a cookie with some sort of ID, and write the results to a text file/database. Then retrieve the data based on ID on the 3rd page.
I prefer the second option, but both should work for a relatively small application like this.

Also, a side note, instead of
my $who = param("firstname"); my $who2 = param("lastname"); my $email = param("email"); my $firstquestion = param("FirstQuestion"); my $secondquestion = param("SecondQuestion"); my $thirdquestion = param("ThirdQuestion"); my $fourthquestion = param("FourthQuestion"); my $fifthquestion = param("FifthQuestion"); my $answerfirstquestion = param("AnswerFirstQuestion"); my $answersecondquestion = param("AnswerSecondQuestion"); my $answerthirdquestion = param("AnswerThirdQuestion"); my $answerfourthquestion = param("AnswerFourthQuestion"); my $answerfifthquestion = param("AnswerFifthQuestion"); my $useranswerfirstquestion = param("UserAnswerFirstQuestion"); my $useranswersecondquestion = param("UserAnswerSecondQuestion"); my $useranswerthirdquestion = param("UserAnswerThirdQuestion"); my $useranswerfourthquestion = param("UserAnswerFourthQuestion"); my $useranswerfifthquestion = param("UserAnswerFifthQuestion"); my $choicesfirstquestion = param("ChoicesFirstQuestion"); my $choicessecondquestion = param("ChoicesSecondQuestion"); my $choicesthirdquestion = param("ChoicesThirdQuestion"); my $choicesfourthquestion = param("ChoicesFourthQuestion"); my $choicesfifthquestion = param("ChoicesFifthQuestion");
You could use
my %cgi_data = Vars(); #Vars() is imported from
I just think it looks a lot cleaner. It also would allow you to simplify your form output using a loop.

- Tom

Replies are listed 'Best First'.
Re: Re: Simple Quiz Maker (cont.)
by matthewb (Curate) on Dec 06, 2003 at 04:36 UTC
    #Vars() is imported from
    Not by default, it isn't. If you want to use the procedural interface to you'll have to make sure the :cgi-lib functions are imported first in order to use Vars() as a function.