<!--
    Brian Platz
    CS85 Section 1643
    Professor Geddes
    April 4, 2012
    Assignment: Rewrite your hobby program from the Unit 2 Assignment using the SuperHTML object.
                The program should appear the same to the user.
                The source code shall be object-oriented using the SuperHTML object.
                Please be sure to provide links to all your source code (...Src.php files) 
                    on your index.html page.
    --> 
    
<?php
  
include "superHTMLDefa.php";
  
extract($_REQUEST);                         // create form variables
  
error_reporting(E_ALL & ~E_NOTICE);         // get rid of runtime notices
  
  
if ( !filter_input(INPUT_POST"user") ) {                    // first time through: empty($_REQUEST), print form
      
$p = new SuperHTML("Hobby SuperHTML -- Form");
      
$p->buildTop("Hobby SuperHTML");
      
$p->startForm("hobbySuperHTML.php""POST");
      
$p->h1($p->label("Your Name: ").$p->textbox(user"") );
      
$p->h1($p->label("Email Address: ").$p->textbox(email"") );
      
$p->h1($p->label("Your Hobby: ").$p->textbox(hobby"") );
      
$p->submit("Submit");
      
$p->endForm();
      
$p->buildBottom();
      print 
$p->getPage();
      
      } else {                                                    
// second time through: print response
      
      
$q = new SuperHTML("Hobby SuperHTML -- Response");
      
$q->buildTop("Hobby SuperHTMLalt");
      
$q->h1("This page is created using <span style='color:red'>extract(\$_REQUEST)</span>.");
      
$q->h1("Hello, <span style='color:red'>$user</span>! Welcome to the PHP page!");
      
$q->h1("We have your email address as: <span style='color:red'>$email</span>," );
      
$q->h1("and your favorite hobby as: <span style='color:red'>$hobby</span>." );
      
$q->buildBottom();
      print 
$q->getPage();
     }
?>