Created
November 28, 2016 06:27
-
-
Save masamasa6210/c2a155b8f9bd03cdefc1aafcb250e43f 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
<html> | |
<head> | |
<title>calc.php</title> | |
</head> | |
<body> | |
<?php | |
//値を習得 | |
if (isset($_POST["selOpe"])){ | |
$a = $_POST['txtA']; | |
$b = $_POST['txtB']; | |
$ope = $_POST['selOpe']; | |
//セレクトボックスによって処理を変える | |
switch($ope){ | |
case "+": | |
$answer = $a+$b; | |
break; | |
case "-": | |
$answer = $a-$b; | |
break; | |
case "×": | |
$answer = $a*$b; | |
break; | |
case "÷": | |
$answer = $a/$b; | |
break; | |
default; | |
break; | |
} | |
//計算結果を表示 | |
print($a."".$ope."".$b."=".$answer."\n"); | |
} | |
?> | |
<br/> | |
<br/> | |
<a href="#" onclick="history.back(); return false;">前の画面に戻る</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment