The Input for Number Can be Made using Form in Html
First We have to implement Form Page by using <form> tag in html.
(fibonacci.html)
<!DOCTYPE html>
<html>
<form method="POST" action="fib.php">
Enter Fibonacci No:<input type="number" name="n1"><br>
</form>
</html>
Embedding php file
<?php $n=$_POST["n1"]; $f0=0; $f1=1; echo "Fibonacci series are:"; for($i=2;$i<$n;$i++) { $f2=$f0+$f1; echo "$f2"," "; $f0=$f1; $f1=$f2; } ?>
Comments
Post a Comment