HTML
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/estilo.css">
<title>ALGORITMOS EM PHP</title>
</head>
<body>
<form method="POST" action="script1.php">
<H1>ESCOLA XYZ</H1>
Valor1: <br> <input type="number" name="val1"><br>
Valor2: <br> <input type="number" name="val2"><br>
Valor3: <br> <input type="number" name="val3"><br>
<input type="Submit" name="Verificar">
</form>
</body>
</html>
SCRIPT
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/estilo.css">
<title>ALGORITMOS EM PHP</title>
</head>
<body>
<?php
$v1 = isset($_POST['val1'])?$_POST['val1']:"Valor 1 não informado";
$v2 = isset($_POST['val2'])?$_POST['val2']:"Valor 2 não informado";
$v3 = isset($_POST['val3'])?$_POST['val3']:"Valor 3 não informado";
$med = ($v1 + $v2 + $v3 )/3;
echo "<h1>A média calculada é: $med </h1><br>";
echo "Suas notas foram: $v1, $v2 e $v3";
?>
</body>
</html>
Nenhum comentário:
Postar um comentário