if(empty($_POST['name'])){
header("location:users_adduser.php?fail=1"); //no name specified
}
If I echo $_POST[‘name’] I can see that it is in fact empty. So what gives? How should I be checking for empty input fields?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to the documentation, an empty string should be considered…well, empty. I’d try using var_dump() on $_POST and see what comes back, maybe it’s not empty after all.
For testing purposes, comment out the header() call for now and perhaps just issue a print statement to ensure that it is actually evaluating to true. It could be a header redirect issue rather than a problem with empty().