Do you have this php bit looking for the submit button? if not, try this code out
[php]<?php
if(isset($_POST[‘submit’])) { // change submit to whatever you named ur button
$chkError = FALSE;
echo “
”;
print_r($_POST);
echo “
”;
if(empty($_POST[‘userName’])) {
$chkError = TRUE;
echo “You did not fill in your name. Please hit the back button on your browser and reenter the information.”;
} else {
$chkError = FALSE;
$userName = mysql_real_escape_string($_POST[‘userName’]);
}
if(empty($_POST[‘address’])) {
$chkError = TRUE;
echo “You did not fill in your address. Please hit the back button on your browser and reenter the information.”;
} else {
$chkError = FALSE;
$address = mysql_real_escape_string($_POST[‘address’]);
}
if(empty($_POST[‘city’])) {
$chkError = TRUE;
echo “You did not fill in your city. Please hit the back button on your browser and reenter the information.”;
} else {
$chkError = FALSE;
$city = mysql_real_escape_string($_POST[‘city’]);
}
if(empty($_POST[‘state’])) {
$chkError = TRUE;
echo “You did not fill in your state. Please hit the back button on your browser and reenter the information.”;
} else {
$chkError = FALSE;
$state = mysql_real_escape_string($_POST[‘state’]);
}
if(empty($_POST[‘zip’])) {
$chkError = TRUE;
echo “You did not fill in your zip code. Please hit the back button on your browser and reenter the information.”;
} else {
$chkError = FALSE;
$zip = mysql_real_escape_string($_POST[‘zip’]);
}
if($chkError == FALSE) {
echo “Hi there, $userName. I see you live at $address, $city, $state $zip”;
}
}
?>[/php]
empty() does the same thing as what you had. It can’t be set (isset()) if its empty, so looking for it is rather redundant.
I don’t know what your form looks like, but each of the fields need to have a name (name = “userName”), else it won’t find it. I took out filter_input() because it wasn’t doing anything, you weren’t telling it what to filter, if you still want to use it, i’d suggest filter_input_array(), then you can just use it on $_POST through a loop in a function.