- <?php
- $c = 0;
- if(isset($_POST["a"]) && $_POST["a"] != "" && isset($_POST["b"]) && $_POST["b"] != "")
- {
- $c = $_POST["a"] + $_POST["b"];
- }
- ?>
- <html>
- <form action="test.php" method="post">
- <input type="text" name="a">
- <input type="text" name="b">
- <input type="text" name="d">
- <input type="submit" value="+">
- </form>
- <div><?php echo($c)?></div>
- </html>
複製代碼 |