<?php include "SuperHTMLDef.php"; $s = new SuperHTML("Working with Forms"); $s->buildTop(); $s->h3("form elements"); $s->addText("<form> \n"); $s->textbox("userName", "Joe"); $s->h3("create select object from associative array"); $numArray = array("1" => "ichii", "2" => "nii", "3" => "san", "4" => "shi"); $s->select("options", $numArray); $s->h3("make form elements inside a table!"); $myArray = array(array($s->gTag("b", "name"), $s->gTextbox("name")), array("address", $s->gTextbox("address")), array("phone", $s->gTextbox("phone")), array("favorite number", $s->gSelect("number", $numArray))); $s->buildTable($myArray); $s->submit(); $s->addText("</form> \n"); $s->h3("results from previous form (if any)"); $s->formResults(); $s->buildBottom(); print $s->getPage(); ?>
<?php include "superHTMLDefa.php"; if (!filter_has_var(INPUT_POST, "user")) { $p = new SuperHTML("Hobby SuperHTML -- Form"); $p->buildTop("This is the new hobby form"); $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 { $q = new SuperHTML("Thank you for using this form"); $q->buildTop("Here is your input"); $q->h1("Hello, {$user}!"); $q->h1("Your email address as: {$email},"); $q->h1("and your favorite hobby is: {$hobby}."); $q->buildBottom(); print $q->getPage(); }