Location: PHPKode > scripts > PHP Calc > php-calc/calculate.php
<?
if (($_POST[val1] == "") || ($_POST[val2] == "") || ($_POST[calc] == "")) {
	header("Location: calculater_form1.html");
	exit;
}
	if ($_POST[calc] == "add") {
	 $result = $_POST[val1] + $_POST[val2];
	} else if ($_POST[calc] == "subtract") {
	 $result = $_POST[val1] - $_POST[val2];
	} else if ($_POST[calc] == "multiply") {
	 $result = $_POST[val1] * $_POST[val2];
	} else if ($_POST[calc] == "divide") {
	 $result = $_POST[val1] / $_POST[val2];

}
?>
	
	
	<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 3</title>
</head>

<body>
<? echo "$result"; ?>
</body>

</html>
Return current item: PHP Calc