The front-end HTML code for my PHP | Calculator is the same as yours but my back-end PHP scripting code differs a little from yours. This is what it I have. What mazes me is that I am not able to successfully run the script, thus, ending up with the PHP parser annoying me with its tedious error scripts. Please, try and help me out if you can. Thank you! :-)
<?php
if (($_POST[Value-1] = "") || ($_POST[Value-2] = "") || ($_POST[Calc] =""))
{
header("Location: caculator.html");
exit;
}
if ($_POST[Calc] == "Add")
{
$result = $_POST[Value-1] + $_POST[Value-2];
}
else if ($_POST[Calc] == "Subtract")
{
$result = $_POST[Value-1] - $_POST[Value-2];
}
if ($_POST[Calc] == "Divide")
{
$result = $_POST[Value-1] / $_POST[Value-2];
}
else if ($_POST[Calc] == "Multiply")
{
$result = $_POST[Value-1] * $_POST[Value-2];
}
?>
<html>
<head>
<title>
PHP | Calculator
</title>
</head>
<body>
<div align="center">
<p>The result of the computation was
<?php
echo ("$result");
?>
</p>
<a href="calculator.html">Back</a >
</div>
</body>
</html>