<?php /* stub version to start */ /*===== function request_color() { ?> <p> called function request_color </p> <p> <a href="<?= htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES) ?>"> Continue </a> </p> <?php } =====*/ /* end of stub version */ ?> <?php /*===== function: request_color purpose: expects no parameters, and tries to read the user's quest from the requesting form, and (safely) use that PLUS $_SESSION["name"] to make a personalized, quest-including request for a favorite color * ALSO saves that quest in $_SESSION for future-application use requires: build_mini_form.php by: Sharon Tuttle last modified: 2026-04-22 =====*/ function request_color() { // if I get here, there better be quest! complain and exit // if not if ( (! array_key_exists("quest", $_POST)) or (trim($_POST["quest"]) == "") ) { complain_and_exit("quest"); } // if get here, SHOULD be a quest... $user_quest = trim(htmlspecialchars($_POST["quest"])); $_SESSION["quest"] = $user_quest; // grab the previously-saved user name $user_name = $_SESSION["name"]; // craft a personalized response including the quest // and requesting their favorite color ?> <h2> AHA, <?= $user_name ?>, <br /> your quest: <?= $user_quest ?> <br /> is NOBLE indeed? </h2> <h2> BUT - WHAT is your FAVORITE COLOR? </h2> <?php build_mini_form("color", "Submit it"); } ?>