PHP Example
Screen shot
Arithmatic Calculation Example

<?php
if(isset($_POST['num1'])){
    $num1=$_POST['num1'];
}

if(isset($_POST['num2'])){
    $num2=$_POST['num2'];
}


if(isset($_POST['add'])){
    $result=$num1+$num2;
}
else if(isset($_POST['sub'])){
    $result=$num1-$num2;
}
else if(isset($_POST['div'])){
    $result=$num1/$num2;
}
else if(isset($_POST['mul'])){
    $result=$num1*$num2;
}
?>
<html>
<head>
<title>Php Example</title>
</head>
<body>
<form name="frm" action="" method="post">
<table border="1" align="center">
<tr>
<td align="center" colspan="2">Arithmetic calculation</td>
</tr>
<tr>
<td>Enter first number</td>
<td><input type="text" name="num1" value="<?php if(isset($num1))echo $num1;?>"/></td>
</tr>
<tr>
<td>Enter second number</td>
<td><input type="text" name="num2" value="<?php if(isset($num2))echo $num2;?>"/></td>
</tr>
<tr>
<td align="center" colspan="4">&nbsp;</td>
</tr>
<tr>
<td><?php if(isset($result))echo $result; else echo "Result Here";?></td>
<td>
<input type="submit" name="add" value="+" />
<input type="submit" name="sub" value="-" />
<input type="submit" name="div" value="/" />
<input type="submit" name="mul" value="*" />
</td>
</tr>
</table>
</form>
</body>
</html>

You can download source code here