Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Simple Quiz Maker

by Anonymous Monk
on Dec 05, 2003 at 04:11 UTC ( [id://312419]=note: print w/replies, xml ) Need Help??


in reply to Simple Quiz Maker

Thanks for the help. Can anyone give me ideas on how to use an if/else statement to correct the quiz?

Replies are listed 'Best First'.
Re: Re: Simple Quiz Maker
by matthewb (Curate) on Dec 05, 2003 at 07:48 UTC
    I ran your program and it seems that Roger has answered your if/else statement question, if that's what you meant.

    Your other problem is a typo which could have been averted using the Vars() method provided by CGI.pm - here's how you'd do that:
    my $q = CGI->new; my $form_variables = $q->Vars; print $form_variables->{FirstQuestion}; # etc...
    I'd have a read through the CGI.pm manpage if I were you.

    As a rule, if you find yourself copy-and-pasting lumps of code inline you can be certain that you are doing something wrong. In this example, your program would be improved by generalising the repeated print statements into a subroutine that took as its arguments a question/answer pair.

    As a general observation, the HTML you are outputting isn't up to much either. Consider closing tags on all those forms at least.

    MB

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://312419]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found