<!--
    Brian Platz
    CS85 Section 1643
    Professor Geddes
    March 12, 2012
    Assignment: Write a PHP script that processes the form data submitted by the form in hobby.html. 
                The "processing" can be anything interesting (use your imagination). 
                Name the file hobby.php.
    File Name: hobby.php
    Responds to: hobby.html
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   <head>
      <title>PHP Unit 2 Ex 4 -- Form</title>
      <style type="text/css">
         body {background-color:#90EE90}
         h1 {color:black; font-family:Ariel; font-size:14pt; font-weight:bold}
         h2 {color:red; font-family:Ariel; font-size:14pt; font-weight:bold}
         h3 {color:black; font-family:Ariel; font-size:24pt; font-weight:normal}
      </style>    
      <script type="text/javascript">
        <!-- Hiding JS from older browsers
        // Stop hiding JS -->
      </script>
   </head>
   <body>
   <?php   
                   
// two different extractions methods used below, to get experience

    
extract($_REQUEST);     // extracts user, email, and hobby    
    
$preamble = <<<TEXT
        <h1>This page is created using <span style='color:red'>extract(\$_REQUEST)</span>.</h1>
TEXT;
    ECHO 
$preamble;
    ECHO 
"<h1>Hello, <span style='color:red'>$user</span>! Welcome to the PHP page!<h1>";
    ECHO 
"<h1>We have your email address as: <span style='color:red'>$email</span>, <br/>
        And your favorite hobby as: <span style='color:red'>
$hobby</span>.";

/*
    $user = filter_input(INPUT_GET, "user");    // extracts user
    $email = $_REQUEST["email"];                // extracts email
    $hobby = $_GET["hobby"];                     // extracts hobby
    
    $preamble = <<<TEXT
        <h1>This page is created using <span style="color:red">filter_input, \$_REQUEST and \$GET</span>.</h1>
TEXT;
    ECHO $preamble;
    ECHO "<h1>Hello, <span style='color:red'>$user</span>! Welcome to the PHP page!<h1>";
    ECHO "<h1>We have your email address as: <span style='color:red'>$email</span>, <br/>
        And your favorite hobby as: <span style='color:red'>$hobby</span>.";
*/        
   
?>  
<br/><br/>
<a href = "../index.html">Return to Index</a>
   </body>
</html>