Friday, 27 April 2012

application in php


<html>
<head>
<style>
p{
text-decoration:blink;
color:white;
font-size:30;
}
</style>
</head>
<body  bgcolor="orange">
<form action="calulator.php" method="post">
<marquee bgcolor="orange" behaviour="slide" height="30" ><font color="white"><b><a href="login.html">Welcome for Registation</a></b></font></marquee>
<p><b>Calculator</b></p>
<table border="2" align="center" bgcolor="red" height="300" width="400">
<br/><br/><br/><br/><tr><td align="right"><font color="white">Enter N:</font></td><td><input type="text" name="n1"></td></tr>
<tr><td  align="right"><font color="white">Enter N:</font></td><td><input type="text" name="n2"></td></tr>
<tr><td  align="right"><select name="n3">
<option>sum</option>
<option>difference</option>
<option>multiple</option>
<option>devision</option>
</select></td>
<td><input type="submit" value="ok"></td></tr>
<tr><td  align="right"><p>The answer is:</p></td><td><?php
$a=$_POST["n1"];
$b=$_POST["n2"];
$c=$_POST["n3"];


 if($c=='sum')
{
$d=$a+$b;
echo "<font color='white'size='10'><b><p>".$d."</font></b></p>";
}
else if($c=='difference')
{
$d=$a-$b;
echo "<p><font color='white'size='10'><b>".$d ."</p></font></b>";
}
else if($c=='multiple')
{
$d=$a*$b;
echo "<p><font color='white'size='10'><b>".$d."</p></font></b>";
}
else if($c=='devision')
{
if($b!='0 ')
{
$d=$a/$b;
echo "<p><font color='white'size='10'><b>".$d."</p></font></b>";
}
else  
echo "Number is not divide by zero";
}


?>
</td></tr>


</form>
</html>

No comments:

Post a Comment