- <?php
- if($_GET["num"]){
- $number=$_GET["num"];
- function Factorial($number){
- $factorial = 1;
- for ($i = 1; $i <= $number; $i++){
- $factorial *= $i;
- }
- return $factorial;
- }
- $fact=Factorial($number);
- echo"Factorial of ".$_GET['num']." is ".$fact;
- exit();
- }
- ?>
- <html>
- <body>
- <form action='<?php $_PHP_SELF?>'method="GET">
- Enter no:<input type="text" name="num"/>
- <input type="submit"/>
- </form>
- </body>
- </html>