Im having troubles with my code and I cant seem to figure out whats wrong im sure its easy for you since im new to perl and i mean New New.
Code:
Code:
<html>
<body bgcolor=gray>
<center><b><head>Average your Grades</head></b></center><br>
<center><form action=/cgi-bin/pretask1.cgi method=post>
Grade 1 <input type=text size=3 name=grade1 maxlength=3><br>
Grade 2 <input type=text size=3 name=grade2 maxlength=3><br>
Grade 3 <input type=text size=3 name=grade3 maxlength=3><br>
Grade 4 <input type=text size=3 name=grade4 maxlength=3><br>
Grade 5 <input type=text size=3 name=grade5 maxlength=3><br>
<br>
<input type=submit>
</body>
</center>
</form>
</html>
#!/usr/bin/perl
$count=0;
print "Content-type:text/html\n\n";
use CGI ':standard';
$grade1=param('grade1');
$grade2=param('grade2');
$grade3=param('grade3');
$grade4=param('grade4');
$grade5=param('grade5');
@array=($grade1,$grade2,$grade3,$grade4,$grade5);
foreach $grade(@array){
print "$grade<br>";
if(($grade !=NULL)||($grade eq 0)){
$count++;
$total=$grade+$total;
}
}
$average=$total/$count;
print "$count"<br>
Total of Grades Entered:$total
Average Grade So Far:$average";
Now with this grading program when I hit submit just the list of grades show up I need it to actually show how many grades I have entered and the average of all the grades. Any help will be appreciated.