<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<!--
    demo of form validation using JavaScript

    by: Sharon Tuttle
    last modified: 2024-04-22

    can run using the URL:
    https://nrs-projects.humboldt.edu/~st10/s24cs328/328lect14-1/three-value.php
-->

<head>
    <title> JavaScript form validation </title>
    <meta charset="utf-8" />

    <?php
        require_once("make_three_value_form.php");
        require_once("make_three_value_response.php");
    ?>

    <link href="https://nrs-projects.humboldt.edu/~st10/styles/normalize.css"
          type="text/css" rel="stylesheet" />

    <link href="three-value.css"
          type="text/css" rel="stylesheet" />    

    <!-- 
        using async here to indicate that it is safe
            to keep parsing the HTML while downloading
            this JavaScript
        (and using async instead of defer because this
            JavaScript doesn't need other scripts to be
            executed before this one)
    -->

    <script src="three-value.js" type="text/javascript"
            async="async" ></script>
</head>

<body>
    <?php

    // if called with method="get", display form for user input

    if ($_SERVER["REQUEST_METHOD"] == "GET")
    {
        make_three_value_form();
    }

    // ...otherwise, display form-response for method="post" form instead

    else
    {
        make_three_value_response();
    }
    ?>

    <footer>
    <hr />
    <p>
        Validate by pasting .xhtml copy's URL into<br />
        <a href="https://validator.w3.org/nu">
            https://validator.w3.org/nu
        </a>
        or  
        <a href="https://html5.validator.nu/">
            https://html5.validator.nu/
        </a>
    </p>
    </footer>
</body>
</html>