Macemore
Circumcised pineapples
I don't know why but it's something about calculators that I like.
This is the 5th one I've made. I took m0nsta.'s suggestion and tried to make it easier to read the code.
Although there's not much of it.
Calc.php
Index.html
Hope you liked it.
Feel free to suggest anything
Screenshots as requested by Vineen:
Answer:
This is the 5th one I've made. I took m0nsta.'s suggestion and tried to make it easier to read the code.
Although there's not much of it.
Calc.php
PHP:
<?php
$num1 = $_POST['number1'];
$num2 = $_POST['number2'];
$methood = $_POST['meth'];
if($methood == 1) {
$a = $num1 + $num2;
echo $a;
} elseif ($methood == 2) {
$a = $num1 - $num2;
echo $a;
} elseif ($methood == 3) {
$a = $num1 / $num2;
echo $a;
} elseif ($methood == 4) {
$a = $num1 * $num2;
echo $a;
} elseif ($methood == 5) {
echo pow($num1, $num2) ;
} else {
echo 'Something went wrong! Please go back and try again!';
}
//Hope this worked out for you!
?>
Index.html
HTML:
<html>
<head>
<title>Calculator</title>
</head>
<body>
<form action="calc.php" method="POST" >
First number: <input type="text" name="number1"><br />
Second number: <input type="text" name="number2"><br />
<p>What to do?</p>
<input type="radio" name="meth" value="1" />Add (First number add the Second)<br />
<input type="radio" name="meth" value="2" />Subtract (first number Subtracted by the second<br />
<input type="radio" name="meth" value="3" />Divide (First number divided by the second)<br />
<input type="radio" name="meth" value="4" />Multiply (First number times the Second number)<br />
<input type="radio" name="meth" value="5" />Exponent (First number is the base, second is the power!)<br />
<input type="submit" value="calculate"
</form>
</body>
</html>
Hope you liked it.
Feel free to suggest anything
Screenshots as requested by Vineen:
Answer: