--- /dev/null
+### basic calc
+
+simple calculator on the web, based from php.
+practice project for php.
\ No newline at end of file
--- /dev/null
+<?php
+ if(isset($_GET["calculate"])){
+ $input1 = (float) $_GET["num1"];
+ $input2 = (float) $_GET["num2"];
+ $operator = $_GET["operation"];
+ $result = null;
+
+ if(empty($input1) || empty($input2)){
+ echo "specify a number into the first and second input.";
+ return;
+ }
+ elseif($operator == "select"){
+ echo "select an operation.";
+ return;
+ }
+
+ switch($operator){
+ case "add":
+ $result = $input1 + $input2;
+ echo "The sum is {$result}";
+ break;
+ case "subtract":
+ $result = $input1 - $input2;
+ echo "The difference is {$result}";
+ break;
+ case "multiply":
+ $result = $input1 * $input2;
+ echo "The product is {$result}";
+ break;
+ case "division":
+ $result = $input1 / $input2;
+ echo "The quotient is {$result}";
+ break;
+ }
+ }
+?>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>basic calc</title>
+</head>
+<body>
+ <h1>basic calc</h1>
+ <form action="<?php htmlspecialchars($_SERVER["PHP_SELF"])?>" method="GET">
+ <label for="num1">first number:</label>
+ <input type="text" name="num1" id="num1"><br>
+ <label for="num1">second number:</label>
+ <input type="text" name="num2" id="num2"><br>
+ <label for="operation">operation:</label>
+ <select name="operation" id="operation">
+ <option value="select" selected>Select</option>
+ <option value="add">Add</option>
+ <option value="subtract">Subtract</option>
+ <option value="multiply">Multiply</option>
+ <option value="divide">Divide</option>
+ </select><br>
+ <input type="submit" name="calculate" value="calculate">
+ </form>
+ <?php include("./backend.php");?>
+</body>
+</html>
\ No newline at end of file