Lunes, Marso 7

PHP: Average Grade Solver


We have here a program that allows a user to input and solve for the average grade.







<form id="form1" name="form1" method="post" action="">
Average Grades
Math<input name="math" type="text" id="math" size="3" maxlength="4" />
English<input name="eng" type="text" id="eng" size="3" maxlength="4" />
Science<input name="sci" type="text" id="sci" size="3" maxlength="4" />
Filipino<input name="fil" type="text" id="fil" size="3" maxlength="4" />
Hekasi<input name="he" type="text" id="he" size="3" maxlength="4" />
PE<input name="pe" type="text" id="pe" size="3" maxlength="4" /></td>
<input name="calc" type="submit" id="calc" value="Get Average" />
Average<?php echo $ave;?>
</form>

<?php
if (isset($_POST['calc']))
{
$m=$_POST['math'];
$e=$_POST['eng'];
$s=$_POST['sci'];
$f=$_POST['fil'];
$h=$_POST['he'];
$p=$_POST['pe'];
$ave=($m+$e+$s+$f+$h+$p)/6;
}
?>

0 comments:

Mag-post ng isang Komento

 
Powered by Blogger