Since the internet is a stateless environment, you need some way of maintaining state.
The options I see for you are:
- Pass all answers through the whole app, using hidden fields.
- 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 CGI.pm
I just think it looks a lot cleaner. It also would allow you to simplify your form output using a loop.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|