Expected value for the post is 0 OR 1 but when the value is zero it returns error
if(!($data['status'] = filter_input(INPUT_POST,'status',FILTER_VALIDATE_INT)))
{
echo'Error';
}
else
return true;
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.
Your
ifstatement is implicitly converting the result of the call tofilter_input()to a boolean and then testing that result. In your case, the result is0which is implicitly converted toFALSE, so the test fails.You need to explicitly test with an identity comparison against
FALSE:See PHP type comparison tables for more information.