Please send questions to st10@humboldt.edu .
<html>

<!-- try_hidden.php

     ... adding a hidden parameter to a form, and making this
     more modular
     
     adapted from "Learning PHP 5", Sklar, O'Reilly, Chapter 9
     adapted by: Sharon Tuttle
     last modified: 11-16-06
-->

<head>
    <title> playing with here documents and hidden parameters
            and better modularization </title>
</head>

<body>
    <h2> playing with here documents and hidden parameters and better
         modularization </h2>    

    <h3>
    <?php
        // make use of the hidden parameter here, instead
        //if (array_key_exists('customer_name',$_POST)) 

        if ($_POST["_submit_check"])
        {
            process_form();
        } 
        else 
        {
            display_form();
        }
    

        // process_form
        // customize the list with the submitted name

        function process_form()
        {
            $name = $_POST["customer_name"];
            print <<<HTMLSTUFF
            $name's items
                <ul> 
                    <li> $name's books
                    <li> $name's magazines
                    <li> $name's bicycles
                </ul>
HTMLSTUFF;
        }

        // display_form
        // ask the user to enter his/her name

        function display_form()
        {
            print <<<HTMLFORM
            <form method="post" action="$_SERVER[PHP_SELF]">
                Your name: <input type="text" name="customer_name">
                <br>
                <input type="submit" value="Say Hello">
                <input type="reset">
                <input type="hidden" name="_submit_check" value="1">
            </form>
HTMLFORM;
    }


    ?>

    </h3>

</body>
</html>