<!-- index.php
Author : Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
Website : http://www.jakerpomperada.com
http://www.jakerpomperada.blogspot.com
Email : jakerpomperada@gmail.com
Address : Bacolod City, Negros Occidental, Philippines
-->
<html>
<style>
body {
font-size: 20;
font-family:sans-serif;
font-weight: bold;
}
input {
font-size: 20px;
font-weight: bold;
}
/* http://cssdemos.tupence.co.uk/button-styling.htm */
input#shiny {
padding: 4px 20px;
/*give the background a gradient*/
background:#ffae00; /*fallback for browsers that don't support gradients*/
background: -webkit-linear-gradient(top, blue,blue);
background: -moz-linear-gradient(top, blue, blue);
background: -o-linear-gradient(top, blue, blue);
background: linear-gradient(top, blue, blue);
border:2px outset #dad9d8;
/*style the text*/
font-family:Andika, Arial, sans-serif; /*Andkia is available at http://www.google.com/webfonts/specimen/Andika*/
font-size:1.1em;
letter-spacing:0.05em;
text-transform:uppercase;
color:#fff;
text-shadow: 0px 1px 10px #000;
/*add to small curve to the corners of the button*/
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
/*give the button a drop shadow*/
-webkit-box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
-moz-box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
box-shadow: rgba(0, 0, 0, .55) 0 1px 6px;
}
/****NOW STYLE THE BUTTON'S HOVER STATE***/
input#shiny:hover, input#shiny:focus {
border:2px solid #dad9d8;
}
</style>
<body>
<?php
$values = $_POST['inputText'];
if(isset($_POST['ClearButton'])){
$values = "";
}
?>
<br>
<h4> Fibonacci Numbers in PHP </h4>
<form action="" method="post">
Give a Number
<input type="text" name="inputText" size="5" maxlength="5"
value="<?php echo $values; ?>" style="width:100px; height:30px;" required autofocus=""/>
<br><br>
<input id="shiny" type="submit" value="Ok" name="SubmitButton"/>
<input id="shiny" type="submit" value="Clear" name="ClearButton"/>
</form>
<?php
// Function to generate the fibonacci series
function DiplayFibonacciSeries($n)
{
$first = 0;
$second = 1;
echo "<h4>Fibonacci Series</h4>";
echo $first.' '.$second.' ';
for($i = 2; $i < $n; $i++){
$third = $first + $second;
echo $third.' ';
$first = $second;
$second = $third;
}
}
$values = $_POST['inputText'];
if(isset($_POST['SubmitButton']))
{
$n= (int)$values;
DiplayFibonacciSeries($n);
}
?>
</body>
</html>
No comments:
Post a Comment