The question is this in php: Read four values for four student grades and print a message stating that the student has passed if the average grade is higher than or equal to 7. If the average grade is less than 7, request the exam grade , add up to the average value and get a new mean. If the new average is greater than or equal to 5, present a message stating that the student has passed the exam. If the student has not been approved, indicate a message stating this condition. Present together with the messages the value of the student average for any condition.
this is the main form:
<!DOCTYPE html>
<html>
<title>Questões</title>
<body>
<form action="q6php.php" method="POST">
Digite a primeira nota: <input type="number" name="n1"><br>
Digite a segunda nota: <input type="number" name="n2"><br>
Digite a terceira nota: <input type="number" name="n3"><br>
Digite a quarta nota: <input type="number" name="n4"><br>
<input type="submit" value="Salvar" name="menu">
</form>
</body>
</html>
This is php:
<?php
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$n3 = $_POST['n3'];
$n4 = $_POST['n4'];
$med = (($n1+$n2+$n3+$n4)/4);
if($med>=7){
echo("aprovado com ". $med);
}else if($med<7){
header('location: q6formdir.php');
$k= $_POST['n5'];
if(isset($_POST['salvar'])){
$mednova = (($med + $k)/2);
if($mednova>=5){
echo("aprovado em exame com ".$mednova);
}else{
echo("reprovado");
}
}
}
?>
and this other is the form that if the mean is less than 7 it will ask for another test:
<!DOCTYPE html>
<html>
<title>Questões</title>
<body>
<form action="q6php.php" method="POST">
Digite a nota do novo exame: <input type="number" name="n5">
<input type="submit" value="salvar" name="salvar">
<input type="hidden" value="n1" name="n1">
<input type="hidden" value="n2" name="n2">
<input type="hidden" value="n3" name="n3">
<input type="hidden" value="n4" name="n4">
</form>
</body>
</html>