index.php
(Apenas Leitura)
<?php
require_once("soma.php");
$n1 = "1";
$n2 = "3";
$resultado = "";
if (isset($_POST['num1'])) {
$n1 = $_POST['num1'];
$n2 = $_POST['num2'];
$resultado = somar($n1,$n2);
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>Fórmula Soma</title>
<meta charset="utf-8">
</head>
<body>
<form method="post">
<label for="num1">Informe nº 1</label>
<input type="number" name="num1" id="num1" value="<?php echo $n1; ?>">
<br>
<label for="num2">Informe nº 2</label>
<input type="number" name="num2" id="num2" value="<?php echo $n2; ?>">
<br>
<input type="submit" value="Calcula">
<input type="number" value="<?php echo $resultado;?>" disabled>
</form>
</body>
</html>