<?php /*----- function: show_farewell purpose: expects nothing, returns nothing, but has the side-effects of trying to read the desired color from the requesting form, and uses it along with prior session name and quest to create a form bidding the user farewell -----*/ function show_farewell() { // if get here -- better be a color in $_POST! // (trim removes leading and trailing blanks // from a string... 8-) ) if ( (! array_key_exists('color', $_POST)) or (! isset($_POST['color']) ) or (trim($_POST['color']) == "") ) { complain_and_exit("color"); } // if get here -- I think I can proceed $fave_color = strip_tags($_POST['color']); $user_name = strip_tags($_SESSION['name']); $user_quest = strip_tags($_SESSION['quest']); ?> <h2> AHA, <?= $user_name ?>, lover of the gentle hue of <?= $fave_color ?>, I let you pass, and wish you WELL on your quest for: <?= $user_quest ?> </h2> <form method="post" action="<?= htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES) ?>"> <input type="submit" value="return to beginning" /> </form> <?php } ?>