Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST["calc"])){
- $fn = $_POST["num1"];
- $sn = $_POST["num2"];
- $op = $_POST["operation"];
- if (is_numeric($fn) && is_numeric($sn)){
- switch ($op){
- case "+": $result = $fn + $sn; break;
- case "-": $result = $fn - $sn; break;
- case "*": $result = $fn * $sn; break;
- case "/":
- if ($sn != 0){
- $result = $fn / $sn;
- } else {
- $result = "На 0 не се дели!";
- }
- break;
- }
- } else {
- $result = "Нe си въвел числа!";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement