Search the Community
Showing results for tags 'empty()'.
-
Which is better empty() or == ""
-
I need this to only print the little note at the bottom if the user has put in all the information.. Help please.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Assignment2</title> </head> <body> <h3>Personal Information </h3> <?php $chkErrors = FALSE; if(!empty($_POST['fName']) && isset($_POST['fName'])) { } else { echo 'First Name Fieldis empty'; } if(!empty($_POST['lName']) && isset($_POST['lName'])) { } else { echo 'Your last name field is empty'; } if(!empty($_POST['city']) && isset($_POST['city'])) { } else { echo 'Your city field is empty'; } if(!empty($_POST['state']) && isset($_POST['state'])) { } else { echo 'Your state field is empty'; } if(!empty($_POST['zipCode']) && isset($_POST['zipCode'])) { } else { echo 'Your zipcode field is empty'; } { $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 <h3> Hi there, $fName $lName, <br /> so you live in $city,<br /> in the great state of $state.<br /> I hear the climate around $zipCode is great this time of year. <br /> $fName, I hear that $state has alot to offer as far as recreation goes.<br />I hope that you have a great summer in $city. <br /></h3> HERE; }