<?php // Get user input from form if ($_SERVER["REQUEST_METHOD"] == "POST") { $a = $_POST["a"]; $b = $_POST["b"]; $Total = $a + $b; echo "The Total of $a and $b is: $Total"; } ?> <!DOCTYPE html> <html> <body> <form method="post"> Enter first number: <input type="number" name="a">
Enter second number: <input type="number" name="b">
<input type="submit" value="Add"> </form> </body> </html>