<html>
<body>
<form action="saja2.php" method="post"/>
<table>
<tr><td>data 1 </td><td><input type="text" name="data1"/></td></tr><br/>
<tr><td>data 2 </td><td><input type="text" name="data2"/></td></tr><br/>
<tr><td>symbol </td><td><input type="text" name="sym"/></td></tr><br/>
</table>
<input type="submit" />
</form>
</body>
</html>
Save file type as "saja2.php"
<?php
$data1=$_POST["data1"];
$data2=$_POST["data2"];
$sym=$_POST["sym"];
echo " data 1 is $data1<br/>";
echo "data 2 is $data2<br/>";
echo "the symbol is $sym<br/>";
$pls = $data1+$data2;
$tol = $data1-$data2;
$dev = $data1/$data2;
$tim = $data1*$data2;
if ($sym=="+")
echo " nilai tambah $pls<br/>";
else if ($sym=="-")
echo " nilai tolak ialah $tol<br/>";
else if ($sym=="/")
echo "nilai bahagi ialah $dev<br/>";
else if ($sym=="*")
echo "nilai darab ialah $tim<br/>";
?>