When the user does not put anything into a field its supposed to tell them to hit the back error… if all fields are filled in it should print the little note…
[code]
Assignment2
What's your name?
Writing a form for user input
Please type your first name:
Please type your last name:
Please type your city:
Please type your State:
Please type your Zipcode:
[/code]
[php]
Assignment2
Personal Information
<?php
$chkerrors = FALSE;
if (!filter_has_var(INPUT_POST, "fName")){
echo " please hit the back arrow and enter your name ";
$ckerrors = TRUE;
}
if (!filter_has_var(INPUT_POST, "lName")){
echo " please hit the back arrow and enter your Last Name ";
$ckerrors = TRUE;
}
if (!filter_has_var(INPUT_POST, "city")){
echo " please hit the back arrow and enter your city";
$ckerrors = TRUE;
}
if (!filter_has_var(INPUT_POST, "state")){
echo " please hit the back arrow and enter your state";
$ckerrors = TRUE;
}
if (!filter_has_var(INPUT_POST, "zipCode")){
echo " please hit the back arrow and enter your zipcode ";
$ckerrors = TRUE;
}
$fName = filter_input(INPUT_POST, "fName");
$lName = filter_input(INPUT_POST, "lName");
$city = filter_input(INPUT_POST, "city");
$state = filter_input(INPUT_POST, "state");
$zipCode = filter_input(INPUT_POST, "zipCode");
if($chkerrors == FALSE) {
echo <<<HERE
Hi there, $fName $lName,
so you live in $city,
in the great state of $state.
I hear the climate around $zipCode is great this time of year.
$fName, I hear that $state has alot to offer as far as recreation goes.
I hope that you have a great summer in $city.
HERE;
}
?>
[/php]