<?php
$fat = $_POST['fat'];
$resul = 1;
for($i = $fat; $i > 1; $i--){
$resul *= $fat;
$fat--;
}
echo "<br><br>".$resul."<br><br><br>";
?>
<form method="post" action="fatorial.php">
<input type="text" name="fat"><br>
<input type="submit" name="aa" value="enviar">
</form>