■
Php計算
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>計算プログラム</title> </head> <body> <form method="POST" action="<?php print $_SERVER['PHP_SELF'] ?>" name="form1"> <input type = "text" name = "txtA"> + <input type = "text" name = "txtB"> = 結果 <br> <input type="submit" value="計算"> </form> <br> <?php $a = $_POST['txtA']; $b = $_POST['txtB']; $c = $a + $b; print('計算結果:' . $c); ?> </body> </html>