Hi,
I'm trying to create a quiz using CGI and HTML5 . Where html5 has the radio boxes and the CGI generates the correct response.
I'v been at this for the past 8 hours. Im not the best at perl . Im hoping that someone could help Thanks
#!/usr/bin/perl
use Modern::Perl;
use warnings;
use strict;
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
print header();
my ($grp1,$grp2,$grp3);
$grp1 = param('grp1');
$grp2 = param('grp2');
$grp3 = param('grp3');
if ($grp1 eq "Correct1" )
{
print p("Question One Is Correct");
}
elsif ($grp1 eq"Incorrect1")
{
print p(" Question One is Incorrect");
}
if ($grp2 eq "Correct2")
{
print p("Question One Is Correct");
}
elsif ($grp2 eq"Incorrect2")
{
print p(" Question One is Incorrect");
}
if ($grp3 eq "Correct3")
{
print p("Q3 is correct" ) ;
}
elsif ($grp3 eq "Incorrect3")
{
print p("q3 is wrong");
}
~
HTML 5
</ul>
</div>
<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="Incorrect1"> Yes<br
+/>
<input type="radio" name="grp1" value="Correct1"> No<br/>
</form>
Q2: You have two individuals, One who's diet consists
+of Mcnuggets from Mcdonalds. And an invdivudal whose diet consists of
+ clean food. Both are at caloric deficit and are excercising. Do you
+think the indivdual with the Mcnugget diet will lose weight ?<br/>
<form action="pagefive.cgi" method="get">
<input type="radio" name="grp2" value="Correct2">Yes<b
+r/>
<input type="radio" name="grp2" value="Incorrect2">No<
+br/>
</form>
Q3: The more over weight you are, the more you will lose w
+hen you start any excercise or diet program <br/>
<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>
as for the cgi, I tried many combinations, I just can't seem to get it right
The thing is, it's not generating the correct response to the questions that were filled.