0
follows the codes:
<html>
<head>
<title>Fatoração</title>
</head>
<body>
<form method="post" action="fator.php">
Numero: <input type="text" name="txtnum"><br>
<input type="submit" name="Calcular">
</form>
</body>
</html>
<?php
$num = $_POST["txtnum"];
$variavel = $num;
$fatorial = $variavel;
while ($variavel > 1) {
$fatorial = $fatorial*($variavel-1);
$variavel--;
}
echo "Número fatorado: $fatorial";
?>
I withdrew, continue giving the same error.
– Leonardo Oliveira
How to know if the form is sent
– rray
At first execution
$_POST["txtnum"]
there is, umisset()
in it already solves.– rray
try to use
isset()
on the buttonCalcular
– 13dev
When I give the isset it returns nothing, and testing with the real Empty(empty variable).
– Leonardo Oliveira