follow 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";
?>