A simple program that will ask the user to give two numbers and then the program will compute the product, and difference of two numbers using PHP programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.My mobile number here in the Philippines is 09173084360.

Program Listing

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Product &amp; Difference of Two Numbers</title>
    <style>
        *,html {
            box-sizing: border-box;
            padding: 0;
            margin: 0;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #fefefe;
            font-family: sans-serif;
            background-color: #19BC9D;
        }

        .container {
            background: #fff;
            border: none;
            text-align: center;
            min-width: 300px;
            color: #fff;
        }

        .title {
            background-color: #14A083;
            padding: 20px;
            border: none;
        }

        .output_wrapper {
            padding: 20px;
            font-size: 20px;
            background-color: #fff;
            margin: 10px 0;
            border: none;
            color: #14A083;
        }

        h1 {
            margin: 0 0 5px;
            line-height: 1;
        }

        p {
            margin: 15px 0 0;
        }
        
        input {
            display: block;
            width: 100%;
            margin-bottom: 20px;
            padding: 10px;
            font-size: 15px;
            text-align: center;
        }

        .output {
            margin: 10px 0;
        }

        button,
        .btnRetry {
            background-color: #14A083;
            color: #fff;
            border: none;
            border-radius: 2px;
            text-align: center;
            text-transform: uppercase;
            text-decoration: none;
            cursor: pointer;
            font-size: 15px;
            padding: 15px 10px;
            width: 100%;
            display: block;
            margin: 20px 0 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="title">
            <h1>Product &amp; Difference<br>of Two Numbers</h1>
            <p>Created By:</p>
            <h2>&#187; Jake R. Pomperada, MAED-IT, MIT &#171;</h2>
        </div>
        <div class="output_wrapper">
        <?php
            if(isset($_POST["btnSubmit"])){
                echo '<p>Your inputs are ' . $_POST["num1"] . ' and ' . $_POST["num2"] . '.</p>
                    <h3 class="output">Product: '. $_POST["num1"] * $_POST["num2"] .'</h3>
                    <h3 class="output">Difference: '. ((int)$_POST["num1"] - (int)$_POST["num2"]) .'</h3>
                    <a href="sub_prod.php" class="btnRetry">Retry?</a>';
            } else {
                echo '<form action="" method="post">
                        <label>Enter 1st number here</label>
                        <input type="number" name="num1" required>

                        <label>Enter 2nd number here</label>
                        <input type="number" name="num2" required>

                        <button type="submit" name="btnSubmit">Submit</button>
                    </form>';
            }
        ?>
        </div>
    </div>
</body>
</html>

Leave a Reply

Your email address will not be published.