Files
aulaphp/aula10.php
111111111111111111111111111 EMAIL bf0d0595ed aulinha›
2025-10-02 20:01:35 -03:00

75 lines
2.3 KiB
PHP

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aula 10</title>
<link rel="stylesheet" href="estilo.css">
</head>
<body>
<header><h1>Aula 10 - Vetor</h1></header>
<nav></nav>
<main>
<?php
$nomes = array("Ana Carolina", "Bianca", "Camila", "Daniela", "Erika","Fernanda");
$nota1 = array(10,9,8,7,6,5);
$nota2 = array(9,8,7,6,5,4);
$x = 0;
while($x <= 5){
echo"<p>$nomes[$x]</p>";
$x++;
}
echo"
<form action='aula10.php' method='POST'>
<p>Digite o nome para ver o resultado:
<input type='text' name='nome'><input type='submit' value='Buscar'></p>
</form>
";
if(isset($_POST["nome"])){
$nome = $_POST["nome"];
}
else{
$nome = null;
}
if($nome != null){
$b = 0;
$x = 0;
while($x <= 5){
if($nome == $nomes[$x]){
$me = ($nota1[$x] + $nota2[$x]) / 2;
if($me >= 6){
echo"<p class='verd'>$nomes[$x] Nota1:$nota1[$x] Nota2: $nota2[$x] Média: $me APROVADA!</p>";
}
else{
echo"<p class='verm'>$nomes[$x] Nota1:$nota1[$x] Nota2: $nota2[$x] Média: $me REPROVADA!</p>";
echo"
<form action='aula10B.php' method='POST'>
<p>Nota da Recuperação:
<input type='hidden' name='me' value='$me'>
<input type='hidden' name='nm' value='$nomes[$x]'>
<input type='text' name='rec'>
<input type='submit' value='Enviar'></p>
</form>
";
}
$b = 1;
}
$x++;
}
if($b == 0){
echo"<p class='verm'>Nome solicitado não encontrado!</p>";
}
}
?>
</main>
<footer><h1>Programação WEB II - Professor James Willian</h1></footer>
</body>
</html>