I'm trying to create a php script to print fibonaaci series. The idea is to add a new number to the series everytime the page is refreshed and print the series.
<?php
if (!isset($_COOKIE["fno"]))
{setcookie("fno",0,time()+3600);}
if (!isset($_COOKIE["sno"]))
{setcookie("sno",1,time()+3600);}
if (!isset($_COOKIE["series"]))
{
$text="0 1 ";
setcookie("series",$text,time()+3600);
}
$fno=$_COOKIE["fno"];
$sno=$_COOKIE["sno"];
$fibostring=$_COOKIE["series"];
//echo $fibostring;
$tno=$fno+$sno;
$fibostring.=$tno . " ";
setcookie("fno",$sno,time()+3600);
setcookie("sno",$tno,time()+3600);
setcookie("series",$fibostring,time()+3600);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fibonacci Series</title>
</head>
<body bgcolor="#FFFFFF">
<div style="font-size:20px; color:#cc0000; margin-top:10px"><?php echo $fibostring ?></div>
</body>
</html>
Check out : din3shie.x10.mx/fibo.php
Can anybody tell me what's wrong ?