StrongFaith II
Member
- Nov 23, 2010
- 307
- 2
Hello devbests !
I coded a VERY SIMPLE CALCULATOR in PHP , so i thought it would be good to release it.
PHP :
Bugs :
When you type - X="Fill the number" and Y="Fill the number" , operator="What ever" it still shows "Fill the number "What ever operator" Fill the number" but after it shows "Error calculating" , hope you understood it xD .
Notice :
If you want to flame me , please do not comment.
Feel free to post improves .
I know the calculator exists on the PC !
Credits :
%100 = (StronGCoder)me = Coding .
saying again : it is VERY SIMPLE calculator!
and yeah , sorry for no screenies , but it is not custimozed or anything to show it , PHP code tells all !
one demo ->
thanks !!
I coded a VERY SIMPLE CALCULATOR in PHP , so i thought it would be good to release it.
PHP :
PHP:
<html>
<head>
<title>Calculator</title>
</head>
<body>
<h1>Calculator - Coded by StronGCoder</h1>
<p>Welcome to our calculator - coded by StronGCoder</p>
<p>Today is <?php echo date("d/m");
if(date("y") == "10") {
echo "/2010";
}
else
{
echo "/2011";
}
?><br>
Tommorow is <?php echo date("d")+1;
echo date("/m/");
if(date("y") == "10") {
echo "2010";
}
else
{
echo "2011";
}
?>
<br>
Thanks for visiting us</p>
<br>
<br>
<form action="/calculator/index.php" method="post">
<input type="text" name="x" value="Fill the number">
<select name="operator">
<option>Choose the operator :</option>
<option>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<input type="text" name="y" value="Fill the number">
<br><input type="submit" value="Calculate">
<?php
if($_POST["x"] == "Fill the number") {
echo "<br><br><b>Fill all fields please</b>";
}
if($_POST["y"] == "Fill the number") {
echo "";
}
if(!$_POST["x"] == "Fill the number") {
echo "<br><b><br>Fill all fields please</b>";
}
if(!$_POST["y"] == "Fill the number") {
echo "";
}
if($_POST["operator"] == "Choose the operator :") {
echo "<br><b>Fill the operator please</b>";
}
if($_POST["operator"] == "+") {
echo "<br><br><b><i>";
echo $_POST["x"] . " + " . $_POST["y"];
echo " = ";
echo $_POST["x"] + $_POST["y"];
}
if($_POST["operator"] == "-") {
echo "<br><br><b><i>";
echo $_POST["x"] . " - " . $_POST["y"];
echo " = ";
echo $_POST["x"] - $_POST["y"];
}
if($_POST["operator"] == "*") {
echo "<br><br><b><i>";
echo $_POST["x"] . " * " . $_POST["y"];
echo " = ";
echo $_POST["x"] * $_POST["y"];
}
if($_POST["operator"] == "/") {
echo "<br><br><b><i>";
echo $_POST["x"] . " / " . $_POST["y"];
echo " = ";
echo $_POST["x"] / $_POST["y"];
}
if($_POST["operator"] == "+" and $_POST["x"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "+" and $_POST["y"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "-" and $_POST["x"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "-" and $_POST["y"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "*" and $_POST["x"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "*" and $_POST["y"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and $_POST["x"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and $_POST["y"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and $_POST["x"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and $_POST["y"] == "Fill the number") {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "+" and !$_POST["x"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "+" and !$_POST["y"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "-" and !$_POST["x"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "-" and !$_POST["y"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "*" and !$_POST["x"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "*" and !$_POST["y"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and !$_POST["x"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
if($_POST["operator"] == "/" and !$_POST["y"]) {
echo "<br><br><b><i>";
echo "Error calculating";
}
?>
</body>
</html>
Bugs :
When you type - X="Fill the number" and Y="Fill the number" , operator="What ever" it still shows "Fill the number "What ever operator" Fill the number" but after it shows "Error calculating" , hope you understood it xD .
Notice :
If you want to flame me , please do not comment.
Feel free to post improves .
I know the calculator exists on the PC !
Credits :
%100 = (StronGCoder)me = Coding .
saying again : it is VERY SIMPLE calculator!
and yeah , sorry for no screenies , but it is not custimozed or anything to show it , PHP code tells all !
one demo ->
You must be registered for see links
(calculator looking something as this , not all the same)thanks !!