Contents of header.php
< html >
< head >
< title >
Example page
< /title >
< /head >
< body >
< div style="" >
< ?php
$dayOfWeek = date("l");
$monthAbbrev = date("M");
$dayNumber = date("d");
$day = date("d");
$month = date("m");
echo($dayOfWeek.", ".$monthAbbrev." ".$dayNumber);
if (($month == 10) && ($day == 31))
{
echo(" - Happy Haloween!!");
echo("< img src='img/pumpkin.png'/ > ");
}
? >
< /div >
Contents of index.php
< ?php
include("header.php");
? >
< form action="results.php" method="GET" >
Which of the following would you be most likely to dress as for halloween?
< br >
< input type="radio" name="costumeSelect" value="cat" / > Cat< br >
< input type="radio" name="costumeSelect" value="vampire" / > Vampire< br >
< input type="radio" name="costumeSelect" value="witch" / > Witch/Warlock< br >
< input type="radio" name="costumeSelect" value="mummy" / > Mummy< br >
< input type="radio" name="costumeSelect" value="doctor" / > Doctor< br >
< br >
What will you actually be dressing as?< br >
< input type="text" name="costume" / >
< br/ >
< input type="submit" value="sumbit" / >
< /form >
< ?php
include("footer.php");
? >
Contents of results.php
< ?php
include("header.php");
? >
< ?php
$costume = "";
$cosSelect = "";
if (isset($_GET["costumeSelect"]))
{
$cosSelect = $_GET["costumeSelect"];
}
else
{
echo("You didn't like any of them?< br / > ");
}
if (isset($_GET["costume"]) && ($_GET["costume"] != ""))
{
$costume = $_GET["costume"];
}
else
{
echo("What, no costume?< br / > ");
}
echo("You said that ".$cosSelect." was your favorite, but you'll be going as ".$costume."< br/ > ");
echo("Here's what other people said: < br/ > ");
$costumes = array("cat","vampire","witch/warlock","mummy","doctor");
echo("< table > ");
for ($i=0;$i< 5;$i++)
{
$percent = rand(10,200);
echo("< tr > < td > ");
echo($costumes[$i]."< /td > < td > ");
echo("< img src='img/orange.gif' width='".$percent."' height='10' / > < /td > < /tr > ");
}
echo("< /table > ");
? >
< ?php
include("footer.php");
? >