次の2つのファイルを作成して、実行結果のとおり動作するプログラムを作成してください。

  • web_tr4.php
  • web_tr4_2.php

実行結果

画面に表示された2つのテキストボックスに数値を入力します。

calc ボタンをクリックすると2つのテキストボックスの数値を足し算した結果が表示されます。

ヒント - web_tr4.php - 完成版

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>PHP Training</title>
</head>
<body>
    <h3>Calc - 1</h3>
    <hr>
    <form action="web_tr4_2.php" method="get">
        <input type="number" name="num1"/>
        +
        <input type="number" name="num2"/>
        <input type="submit" value="calc"/>
    </form>
</body>
</html>

web_tr4.php ファイルの実装は完了しています。

ヒント - web_tr4_2.php

<?php
# TODO
?>
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>PHP Training</title>
</head>
<body>
    <h3>Calc - 1</h3>
    <hr>
    <p>Total: <?php echo $total ?></p>
</body>
</html>

TODOの部分を実装します。