<?php session_start(); ?> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <!-- using session variables to control a multi-state application by: Sharon Tuttle last modified: 2025-04-23 you can run this via the URL: https://nrs-projects.humboldt.edu/~st10/s25cs328/328lect13-2/try-quad.php --> <head> <title> try-quad </title> <meta charset="utf-8" /> <?php /* bring in some needed PHP functions */ require_once("request_name.php"); require_once("request_quest.php"); require_once("request_color.php"); require_once("show_farewell.php"); require_once("complain_and_exit.php"); require_once("build_mini_form.php"); ?> <link href="http://users.humboldt.edu/smtuttle/styles/normalize.css" type="text/css" rel="stylesheet" /> </head> <body> <h1> try-quad </h1> <?php // I decide to use a next_state $_SESSION key to help // navigate through my application if (! array_key_exists("next_state", $_SESSION)) { request_name(); $_SESSION["next_state"] = "quest"; } elseif ($_SESSION["next_state"] == "quest") { request_quest(); $_SESSION["next_state"] = "color"; } elseif ($_SESSION["next_state"] == "color") { request_color(); $_SESSION["next_state"] = "farewell"; } elseif ($_SESSION["next_state"] == "farewell") { show_farewell(); session_destroy(); } // I HOPE I cannot reach here, BUT just in case, // IF I do, destroy the session else { session_destroy(); ?> <p> <strong> YIKES! should NOT have been able to reach here! </strong> </p> <p> <a href="<?= htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES) ?>"> Start over </p> <?php } ?> <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>