etsted Posted April 19, 2014 Share Posted April 19, 2014 i am trying to make a validation script. This script return false if i use two or more variables that are empty $usernameErr = $pass1Err = $emailErr = $genderErr = $pass2Err = $wrong_passErr = ""; if($emailErr && $usernameErr == "") { echo "right"; } else { echo "wrong"; } // this returns false if($usernameErr == "") { echo "right"; } else { echo "wrong"; } // this return true if($emailErr == "") { echo "right"; } else { echo "wrong"; } // this returns true Link to comment Share on other sites More sharing options...
davej Posted April 20, 2014 Share Posted April 20, 2014 An empty string has a falsy value. if($emailErr === "" && $usernameErr === "") Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now