StrongFaith II
Member
- Nov 23, 2010
- 307
- 2
Hey people!!
Finally after MUCH errors and problems Advanced-coded Calculator R2.
Hope you like it
---->CALCULATOR<----
Calculator have ONLY 1% bugs , you may find them and post in comment or find and fix , also post in comment.
Calculator is not coded in 1 file for "select" problems
index.php :
results_way1.php:
results_way2.php:
results_way3.php:
No screenies , PHP code tells all what it does have in
Rate and feel free to thanks me
Notice:
do not comment if you wanna flame
Feel free to make fixes
do not count this as your work
Credits:
Me-strongcoder - 100%
THANKS!!!
StronGCoder
Finally after MUCH errors and problems Advanced-coded Calculator R2.
Hope you like it
---->CALCULATOR<----
Calculator have ONLY 1% bugs , you may find them and post in comment or find and fix , also post in comment.
Calculator is not coded in 1 file for "select" problems
index.php :
PHP:
<html>
<head>
<title>Calculator R2</title>
</head>
<body>
<style type="text/css">
body {
background-color: darkgreen;
background-repeat: repeat;
}
</style>
<font color="orange"><b><h2>Calculator</h2><br>
Welcome to Calculator Coded by StronGCoder.<br>
Today is <?php echo date("d/m/y"); ?>.<br>
Thanks for vising us<br><br>
<h3><b>Choose a way to calculate</b></h3></font>
<br><br>
<big><font color="black">NOTICE: All operators are "+" but that doesn't mean it can be ONLY "+" .</big></font>
<br><br>
<form action="./index.php" method="post">
<select name="wTc">
<option>First Number + Second Number</option>
<option>( First Number + Second Number ) + ( Third number + Fourth number )</option>
<option>First Number + ( Second Number + Third Number )</option>
</select>
<br><br>
<input type="submit" value="Go on...">
<?php
if($_POST["wTc"] == "First Number + Second Number")
{
?>
<br><br>
<a href="./results_way1.php"><font color="orange">Choose this way to calculate</font></a>
<?php
}
?>
<?php
if($_POST["wTc"] == "( First Number + Second Number ) + ( Third number + Fourth number )")
{
?>
<br><br>
<a href="./results_way2.php"><font color="orange">Choose this way to calculate</font></a>
<?php
}
?>
<?php
if($_POST["wTc"] == "First Number + ( Second Number + Third Number )")
{
?>
<br><br>
<a href="./results_way3.php"><font color="orange">Choose this way to calculate</font></a>
<?php
}
?>
</b>
</form>
</body>
</html>
results_way1.php:
PHP:
<html>
<head>
<title>Calculator Way 1</title>
</head>
<body>
<style type="text/css">
body {
background-color: darkgreen;
background-repeat: repeat;
}
</style>
<b>
<font color="orange">
<form action="results_way1.php" method="post">
First number: <input type="number" name="x"><br>
Operator: <input type="operator" name="oper"><br>
Second Number: <input type="number" name="y"><br>
<br><input type="submit" value="Go on..."><br>
<?php
if(!$_POST["x"])
{
echo "<br><br>Fill the first number please";
}
if(!$_POST["oper"])
{
echo "<br><br>Fill the correct operator please";
}
if(!$_POST["y"])
{
echo "<br><br>Fill the second number please";
}
if($_POST["oper"] == "+")
{
echo "<br><br>";
echo $_POST["x"] . " + " . $_POST["y"];
echo " = ";
echo $_POST["x"] + $_POST["y"];
}
if($_POST["oper"] == "-")
{
echo "<br><br>";
echo $_POST["x"] . " - " . $_POST["y"];
echo " = ";
echo $_POST["x"] - $_POST["y"];
}
if($_POST["oper"] == "*")
{
echo "<br><br>";
echo $_POST["x"] . " * " . $_POST["y"];
echo " = ";
echo $_POST["x"] * $_POST["y"];
}
if($_POST["oper"] == "/")
{
echo "<br><br>";
echo $_POST["x"] . " / " . $_POST["y"];
echo " = ";
echo $_POST["x"] / $_POST["y"];
}
?>
</b>
</font>
</form>
</body>
</html>
results_way2.php:
PHP:
<html>
<head>
<title>Calculator Way 2</title>
</head>
<body>
<style type="text/css">
body {
background-color: darkgreen;
background-repeat: repeat;
}
</style>
<font color="orange">
<b>
<form action="results_way2.php" method="post">
( First number: <input type="number" name="x"><br>
First Operator: <input type="operator" name="oper"><br>
Second number: <input type="number" name="y"> ) <br>
Second Operator: <input type="operator" name="oper2"><br>
( Third number: <input type="number" name="x2"><br>
Third Operator: <input type="operator" name="oper3"><br>
Fourth number: <input type="number" name="y2"> )<br>
<br><input type="submit" value="Go on..."><br><br>
<?php
if(!$_POST["x"])
{
echo "<br><br>Fill the first number please<br><br>";
}
if(!$_POST["oper"])
{
echo "<br><br>Fill the first operator please<br><br>";
}
if(!$_POST["y"])
{
echo "<br><br>Fill the second number please<br><br>";
}
if(!$_POST["oper2"])
{
echo "<br><br>Fill the second operator please<br><br>";
}
if(!$_POST["x2"])
{
echo "<br><br>Fill the third number please<br><br>";
}
if(!$_POST["oper3"])
{
echo "<br><br>Fill the third operator please<br><br>";
}
if(!$_POST["y2"])
{
echo "<br><br>Fill the fourth number please<br><br>";
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "+" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " + " . $_POST["y"] . " + " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "+" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " + " . $_POST["y"] . " + " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) + ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "+" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " + " . $_POST["y"] . " + " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) + ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "+" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " + " . $_POST["y"] . " + " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) + ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "-" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " + " . $_POST["y"] . " - " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) - ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "*" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " + " . $_POST["y"] . " * " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) * ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "/" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " + " . $_POST["y"] . " / " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) / ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "-" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " + " . $_POST["y"] . " - " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) - ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "-" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " + " . $_POST["y"] . " - " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) - ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "-" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " + " . $_POST["y"] . " - " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "*" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " + " . $_POST["y"] . " * " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) * ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "*" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " + " . $_POST["y"] . " * " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) * ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "*" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " + " . $_POST["y"] . " * " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) * ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "/" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " + " . $_POST["y"] . " / " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) / ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "/" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " + " . $_POST["y"] . " / " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) / ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "/" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " + " . $_POST["y"] . " / " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] + $_POST["y"] ) / ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "+" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " - " . $_POST["y"] . " + " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "+" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " - " . $_POST["y"] . " + " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) + ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "+" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " - " . $_POST["y"] . " + " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) + ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "+" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " - " . $_POST["y"] . " + " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) + ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "-" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " - " . $_POST["y"] . " - " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) - ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "*" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " - " . $_POST["y"] . " * " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) * ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "/" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " - " . $_POST["y"] . " / " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) / ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "-" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " - " . $_POST["y"] . " - " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) - ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "-" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " - " . $_POST["y"] . " - " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) - ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "-" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " - " . $_POST["y"] . " - " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "*" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " - " . $_POST["y"] . " * " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) * ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "*" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " - " . $_POST["y"] . " * " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) * ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "*" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " - " . $_POST["y"] . " * " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) * ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "/" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " - " . $_POST["y"] . " / " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) / ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "/" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " - " . $_POST["y"] . " / " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) / ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "/" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " - " . $_POST["y"] . " / " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] - $_POST["y"] ) / ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "+" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " * " . $_POST["y"] . " + " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "+" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " * " . $_POST["y"] . " + " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) + ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "+" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " * " . $_POST["y"] . " + " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) + ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "+" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " * " . $_POST["y"] . " + " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) + ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "-" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " * " . $_POST["y"] . " - " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) - ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "*" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " * " . $_POST["y"] . " * " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) * ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "/" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " * " . $_POST["y"] . " / " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) / ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "-" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " * " . $_POST["y"] . " - " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) - ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "-" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " * " . $_POST["y"] . " - " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) - ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "-" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " * " . $_POST["y"] . " - " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "*" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " * " . $_POST["y"] . " * " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) * ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "*" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " * " . $_POST["y"] . " * " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) * ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "*" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " * " . $_POST["y"] . " * " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) * ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "/" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " * " . $_POST["y"] . " / " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) / ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "/" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " * " . $_POST["y"] . " / " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) / ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "/" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " * " . $_POST["y"] . " / " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] * $_POST["y"] ) / ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "+" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " / " . $_POST["y"] . " + " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "+" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " / " . $_POST["y"] . " + " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) + ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "+" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " / " . $_POST["y"] . " + " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) + ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "+" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " / " . $_POST["y"] . " + " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) + ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "-" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " / " . $_POST["y"] . " - " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) - ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "*" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " / " . $_POST["y"] . " * " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) * ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "/" and $_POST["oper3"] == "+")
{
echo $_POST["x"] . " / " . $_POST["y"] . " / " . $_POST["x2"] . " + " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) / ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "-" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " / " . $_POST["y"] . " - " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) - ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "-" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " / " . $_POST["y"] . " - " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) - ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "-" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " / " . $_POST["y"] . " - " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) + ( $_POST["x2"] + $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "*" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " / " . $_POST["y"] . " * " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) * ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "*" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " / " . $_POST["y"] . " * " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) * ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "*" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " / " . $_POST["y"] . " * " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) * ( $_POST["x2"] / $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "/" and $_POST["oper3"] == "-")
{
echo $_POST["x"] . " / " . $_POST["y"] . " / " . $_POST["x2"] . " - " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) / ( $_POST["x2"] - $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "/" and $_POST["oper3"] == "*")
{
echo $_POST["x"] . " / " . $_POST["y"] . " / " . $_POST["x2"] . " * " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) / ( $_POST["x2"] * $_POST["y2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "/" and $_POST["oper3"] == "/")
{
echo $_POST["x"] . " / " . $_POST["y"] . " / " . $_POST["x2"] . " / " . $_POST["y2"];
echo " = ";
echo ( $_POST["x"] / $_POST["y"] ) / ( $_POST["x2"] / $_POST["y2"] );
}
?>
results_way3.php:
PHP:
<html>
<head>
<title>Calculator Way 3</title>
</head>
<body>
<style type="text/css">
body {
background-color: darkgreen;
background-repeat: repeat;
}
</style>
<b>
<font color="orange">
<form action="results_way3.php" method="post">
First number: <input type="number" name="x"><br>
First Operator: <input type="operator" name="oper"><br>
( Second Number: <input type="number" name="y"><br>
Second Operator: <input type="operator" name="oper2"><br>
Third Number: <input type="number" name="x2"><br>
<br><input type="submit" value="Go on..."><br>
<?php
if(!$_POST["x"])
{
echo "<br><br>Fill the first number please";
}
if(!$_POST["oper"])
{
echo "<br><br>Fill the first operator please";
}
if(!$_POST["y"])
{
echo "<br><br>Fill the second number please";
}
if(!$_POST["oper2"])
{
echo "<br><br>Fill the second operator please";
}
if(!$_POST["x2"])
{
echo "<br><br>Fill the third number please";
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "+")
{
echo "<br><br>";
echo $_POST["x"] . " + " . $_POST["y"] . " + " . $_POST["x2"];
echo " = ";
echo $_POST["x"] + ( $_POST["y"] + $_POST["x2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "-")
{
echo "<br><br>";
echo $_POST["x"] . " + " . $_POST["y"] . " - " . $_POST["x2"];
echo " = ";
echo $_POST["x"] + ( $_POST["y"] - $_POST["x2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "*")
{
echo "<br><br>";
echo $_POST["x"] . " + " . $_POST["y"] . " * " . $_POST["x2"];
echo " = ";
echo $_POST["x"] + ( $_POST["y"] * $_POST["x2"] );
}
if($_POST["oper"] == "+" and $_POST["oper2"] == "/")
{
echo "<br><br>";
echo $_POST["x"] . " + " . $_POST["y"] . " / " . $_POST["x2"];
echo " = ";
echo $_POST["x"] + ( $_POST["y"] / $_POST["x2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "+")
{
echo "<br><br>";
echo $_POST["x"] . " - " . $_POST["y"] . " + " . $_POST["x2"];
echo " = ";
echo $_POST["x"] - ( $_POST["y"] + $_POST["x2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "-")
{
echo "<br><br>";
echo $_POST["x"] . " - " . $_POST["y"] . " - " . $_POST["x2"];
echo " = ";
echo $_POST["x"] - ( $_POST["y"] - $_POST["x2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "*")
{
echo "<br><br>";
echo $_POST["x"] . " - " . $_POST["y"] . " * " . $_POST["x2"];
echo " = ";
echo $_POST["x"] - ( $_POST["y"] * $_POST["x2"] );
}
if($_POST["oper"] == "-" and $_POST["oper2"] == "/")
{
echo "<br><br>";
echo $_POST["x"] . " - " . $_POST["y"] . " / " . $_POST["x2"];
echo " = ";
echo $_POST["x"] - ( $_POST["y"] / $_POST["x2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "+")
{
echo "<br><br>";
echo $_POST["x"] . " * " . $_POST["y"] . " + " . $_POST["x2"];
echo " = ";
echo $_POST["x"] * ( $_POST["y"] + $_POST["x2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "-")
{
echo "<br><br>";
echo $_POST["x"] . " * " . $_POST["y"] . " - " . $_POST["x2"];
echo " = ";
echo $_POST["x"] * ( $_POST["y"] - $_POST["x2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "*")
{
echo "<br><br>";
echo $_POST["x"] . " * " . $_POST["y"] . " * " . $_POST["x2"];
echo " = ";
echo $_POST["x"] * ( $_POST["y"] * $_POST["x2"] );
}
if($_POST["oper"] == "*" and $_POST["oper2"] == "/")
{
echo "<br><br>";
echo $_POST["x"] . " * " . $_POST["y"] . " / " . $_POST["x2"];
echo " = ";
echo $_POST["x"] * ( $_POST["y"] / $_POST["x2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "+")
{
echo "<br><br>";
echo $_POST["x"] . " / " . $_POST["y"] . " + " . $_POST["x2"];
echo " = ";
echo $_POST["x"] / ( $_POST["y"] + $_POST["x2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "-")
{
echo "<br><br>";
echo $_POST["x"] . " / " . $_POST["y"] . " - " . $_POST["x2"];
echo " = ";
echo $_POST["x"] / ( $_POST["y"] - $_POST["x2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "*")
{
echo "<br><br>";
echo $_POST["x"] . " / " . $_POST["y"] . " * " . $_POST["x2"];
echo " = ";
echo $_POST["x"] / ( $_POST["y"] * $_POST["x2"] );
}
if($_POST["oper"] == "/" and $_POST["oper2"] == "/")
{
echo "<br><br>";
echo $_POST["x"] . " / " . $_POST["y"] . " / " . $_POST["x2"];
echo " = ";
echo $_POST["x"] / ( $_POST["y"] / $_POST["x2"] );
}
?>
</b>
</font>
</form>
</body>
</html>
No screenies , PHP code tells all what it does have in
Rate and feel free to thanks me
Notice:
do not comment if you wanna flame
Feel free to make fixes
do not count this as your work
Credits:
Me-strongcoder - 100%
THANKS!!!
StronGCoder