I have trouble with the following code. With lines 59-65, I need to create a third page to display the answers the user has input. Any ideas or help would be greatly appreciated. Thanks.
#!/usr/bin/perl
use strict;
use CGI qw(:standard);
print header, start_html("Quiz Maker"),
h1("Quiz Maker");
if (param()) {
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");
print p("Thank You. Here is your quiz:");
print p("Name: $who $who2");
print hr(), start_form();
print p("Question #1: $firstquestion");
print p("Answer:", textfield("UserAnswerFirstQuestion"));
print hr(), start_form();
print p("Question #2: $secondquestion");
print p("Answer:", textfield("UserAnswerSecondQuestion"));
print hr(), start_form();
print p("Question #3: $thirdquestion");
print p("Answer:", textfield("UserAnswerThirdQuestion"));
print hr(), start_form();
print p("Question #4: $fourthquestion");
print p("Answer:", textfield("UserAnswerFourthQuestion"));
print hr(), start_form();
print p("Question #5: $fifthquestion");
print p("Answer:", textfield("UserAnswerFifthQuestion"));
print hr(), start_form();
print p(submit("Submit"), reset("Reset"));
print end_form(), hr();
print hr(), start_form();
print p ("Thank you for taking the quiz.");
print p ("For question #1, your answer was $useranswerfirstquestio
+n");
print p ("For question #2, your answer was $useranswersecondquesti
+on");
print p ("For question #3, your answer was $useranswerthirdquestio
+n");
print p ("For question #4, your answer was $useranswerfourthquesti
+on");
print p ("For question #5, your answer was $useranswerfifthquestio
+n");
} 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"));
print hr(), start_form();
print p("What is your first question", textfield("FirstQuestion"))
+;
print p("Please enter the answer", textfield("AnswerFirstQuestion"
+));
print hr(), start_form();
print p("What is your second question", textfield("SecondQuestion"
+));
print p("Please enter the answer", textfield("AnswerSecondQuestion
+"));
print hr(), start_form();
print p("What is your third question", textfield("ThirdQuestion"))
+;
print p("Please enter the answer", textfield("AnswerThirdQuestion"
+));
print hr(), start_form();
print p("What is your fourth question", textfield("FourthQuestion"
+));
print p("Please enter the answer", textfield("AnswerFourthQuestion
+"));
print hr(), start_form();
print p("What is your fifth question", textfield("FifthQuestion"))
+;
print p("Please enter the answer", textfield("AnswerFifthQuestion"
+));
print hr(), start_form();
print p(submit("Submit"), reset("Reset"));
print end_form(), hr();
}
print end_html
-
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.