" .
" PHP In-Class Example #1 " .
" \n" .
"
~lbaker >> cosc4351 >> " .
" example1.php
\n" ;
if( empty($_POST)) // nothing sent to page, so print form
{
print " \n";
### this is where the input form begins....
print "
\n" ;
}
else // we have posted data, check for it
{
// get parameters posted from form
$name = $_POST['theName']; // value from form input
$major = $_POST['theMajor']; // value from form input
if($name =="" || $major == "")
{
print " \n " .
"
Error -- You must enter both a " .
" name and a major!
\n".
"
\n".
"
\n";
}
else
{
print " Hello $name
\n" .
" We are glad to have you majoring in " .
" $major at St. Edward's!
\n".
"
\n".
"
\n";
}
## now call a method to output the page footer
}
printDocFooter();
?>