Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: cgi based quiz

by poj (Abbot)
on Apr 23, 2016 at 10:25 UTC ( [id://1161298]=note: print w/replies, xml ) Need Help??


in reply to cgi based quiz

Put all the inputs in one form

<div id="h3"> <h1> Little quiz </h1> </div> <br/> <form action="pagefive.cgi" method="get"> Q1: Intermittent Fasting determines your food diet<br/> <input type="radio" name="grp1" value="Incorrect">Yes<br/> <input type="radio" name="grp1" value="Correct">No<br/> Q2: You have two individuals, One who's diet consists of Mcnuggets f +rom Mcdonalds. And an invdivudal whose diet consists of clean food. Both are at caloric deficit and are exercising. Do you think the indivdual with the Mcnugget diet will lose weight ? +<br/> <input type="radio" name="grp2" value="Correct">Yes<br/> <input type="radio" name="grp2" value="Incorrect">No<br/> Q3: The more over weight you are, the more you will lose when you st +art any excercise or diet program <br/> <input type="radio" name="grp3" value="Correct">Yes<br/> <input type="radio" name="grp3" value="Incorrect">No<br/> <input type="submit" value="Submit"> </form>
#!/usr/bin/perl use warnings; use strict; use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser/; print header(); print start_html; for my $n (1..3){ print p("Question $n is ".param('grp'.$n)); } print end_html;
poj

Replies are listed 'Best First'.
Re^2: cgi based quiz
by sargg55 (Novice) on Apr 23, 2016 at 10:31 UTC
    Thanks. Would it be too much to ask if you could explain to me what I did wrong ? Much appreciated
Re^2: cgi based quiz
by sargg55 (Novice) on Apr 23, 2016 at 10:35 UTC
    Hi, Thanks for your help. I've been at this for over 9 hours now( no lie) I just want to know, what was wrong with my old code in cgi and html5 ? the reason why I placed format thrice is because the circles would fill twice or jump. so I thought that would solve it. as for cgi, I think I did what I thought it would be logical .

      The submit sends the parameters within the form tags, ie grp3. The grp1, and grp2 parameters are contained within other forms (without a submit)

      <form action="pagefive.cgi" method="get"> <input type="radio" name="grp3" value="Correct3">Yes< +br/> <input type="radio" name="grp3" value="Incorrect3">No + <br/> <input type="submit" value="Submit"> </form>
      poj
        Would have probably never figured that out Thanks again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found