Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

In reply to Simple Quiz Maker (cont.) by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-18 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found