Last active
November 19, 2015 10:53
-
-
Save bilinin/0c7aabb24a6f4025a8d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PHP Калькулятор</title> | |
</head> | |
<body> | |
<center> | |
<?php | |
$one = $_POST['one']; | |
$two = $_POST['two']; | |
$rez = 0; | |
$fun = $_POST['but']; | |
switch ($fun) { | |
case "+": | |
$rez = $one+$two; | |
break; | |
case "-": | |
$rez = $one-$two; | |
break; | |
case "*": | |
$rez = $one*$two; | |
break; | |
case "/": | |
$rez = $one/$two; | |
break; | |
} | |
echo "Result = "; | |
echo $rez; | |
?> | |
<form action="index.php" method="post"> | |
<p> | |
One:<input name='one' value="<?php echo $one; ?>"> | |
</p> | |
<p> | |
Two:<input name='two' value="<?php echo $two; ?>"> | |
</p> | |
<p> | |
<input type="submit" value="+" name="but"> | |
<input type="submit" value="-" name="but"> | |
<input type="submit" value="*" name="but"> | |
<input type="submit" value="/" name="but"> | |
</p> | |
</center> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment