firstphpform.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">  

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="author" content="your name">
        <meta name="description" content="include some description about your page">  

        <title>Bootstrap Form Example</title>

        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> 
    </head>

    <body>


        <div class="container" style="margin-top: 15px;">
            <div class="row col-xs-12">
                <h1>Example Form</h1>
            </div>
            <div class="row col-xs-12">
                <form action="formsubmit.php" method="post">
                    <div class="mb-3">
                        <label for="name" class="form-label">Name</label>
                        <input type="text" class="form-control" id="name" name="fullname">
                    </div>
                    <div class="mb-3">
                        <label for="email" class="form-label">Email address</label>
                        <input type="email" class="form-control" id="email" name="email" aria-describedby="emailHelp">
                        <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
                    </div>
                    <div class="mb-3">
                        <label for="year" class="form-label">Class Year</label>
                        <select id="year" name="year" class="form-select">
                            <option selected>Choose your class year</option>
                            <option value="first">First Year</option>
                            <option value="second">Second Year</option>
                            <option value="third">Third Year</option>
                            <option value="fourth">Fourth Year</option>
                            <option value="grad">Graduate</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label for="number" class="form-label">Favorite Number</label>
                        <input type="text" class="form-control" id="number" name="number" aria-describedby="numberHelp">
                        <div id="numberHelp" class="form-text">But it must start with a 1.</div>
                    </div>
                    <div class="mb-3 form-check">
                        <input type="checkbox" class="form-check-input" id="happy" name="happy" value="yes">
                        <label class="form-check-label" for="happy">I am happy today</label>
                    </div>


                    <button type="submit" class="btn btn-primary">Submit</button>
                </form>
            </div>
        </div>


        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
    </body>
</html>

formsubmit.php

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">  

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="author" content="your name">
        <meta name="description" content="include some description about your page">  

        <title>Form Example Submission Page</title>

        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> 
    </head>

    <body>


        <div class="container" style="margin-top: 15px;">
            <div class="row col-xs-12">
                <h1>Example Form Submission</h1>
            </div>
           <div class="row col-xs-12">
           <?php
                if (!is_numeric($_POST["number"])) {
                    die("Please submit your favorite number as a decimal");
                }
                $result = preg_match("/^1[0-9]*/",$_POST["number"]);
                if ($result !== 1) {
                    die("You must submit a number beginning with 1");
                }                
                if (isset($_POST["happy"])) {
                    echo "Hello " . $_POST["fullname"] . ", glad you are happy today!";
                } else {
                    echo "Hello " . $_POST["fullname"];
                    echo ", sorry you aren't happy.  We'll check on you tomorrow at ";
                    echo $_POST["email"] . ".";
                } 
            ?>
            </div>
        </div>


        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
    </body>
</html>