Making calculator using php
Html , php and java script codecode
<!DOCTYPE html>
<head>
</head>
<br> <br>
<br>
<center>
<table width="200" border = "2" bordercolor = "#000033" bordercolor = "#FF00FF" >
<tr>
<td>
<table border = "1"
bgcolor = "#FFFFFF" width = "210" height = "30"
>
<tr>
<td>
<?php
error_reporting(0);
if( isset ($_POST ['sub'] ) )
{
$value1 = $_POST ['val1']
;
$value2 = $_POST ['val2'] ;
$cal = $_POST ['cal']
;
If ( $value1 == '' )
{
echo " < script > alert ( ' please enter value ' ) < / script
> " ;
exit() ;
}
If ( $value2 == '' )
{
echo " < script > alert ( ' please enter value ' ) < / script
> " ;
exit() ;
}
If ( $cal
== '' )
{
echo " < script > alert ( ' please enter value ' ) < / script
> " ;
exit() ;
}
switch
( $cal )
{
case "+"
:
echo $value1 + $value2 ;
break
;
case
"-" :
echo $value1
- $value2 ;
break
;
case
"*" :
echo $value1
* $value2 ;
break
;
case "/" :
echo $value1 / $value2 ;
break
;
}
}
?>
</td>
</tr>
</table>
< center >< br >< br >< br >< strong
>< font color="#0066FF" >Simple Umar Calculator< /font ><
strong>
< body bgcolor = "#00FFFF" >
< form action = "cal.php" method = "post" >
< table >
<tr>
<td> Value1:
</td>
<td> <input
name = "val1" type = "text"
></td>
</tr>
<td> Sign: </td>
<td> <input
name = "cal" type = "text"> </td>
</tr>
<tr>
<td> Value2:
</td>
<td> <input
name = "val2" type = "text" > </td>
</tr>
<tr>
<tr>
<td colspan = "2">
< center >< input name = "sub" type = "submit" value = "CaLcUlAtE" > </center> </td>
</tr>
</table>
</form>
</center>
</td>
</tr>
</table>
</center>
</body>
![]() |
umar farooque khan |
1 comment:
gud uk...... nyc one
Post a Comment