I am processing a form and in turn, receiving a response code based on the information submitted. I have a list of approximately 40 response codes (and their meaning) in my hands and am trying to build an 'if' statement that checks against a predefined array and returns a specific value.
Just not sure how to do this
First pass conceptually:
$bads = array (1,2,3,4,5,6)
if ($output['responsecode'] == (any value in $bads) {
echo "you suck";
}
EDIT - Still receiving errors
I am using the following code:
$bad_resp1 = array("D","M","A","B","W","Z","P","L","N","C","U","G","I","R","E","S","0","O","B");
$bad_resp2 = array("N","P","S","U");
$bad_resp3 = array("200","201","202","203","204","220","221","222","223","224","225","250","261","262","263","264","300","400","410","411","420","421","430","440","441","460","461");
then calling the 'if' statement:
if (in_array($output['response1'], $bad_resp1) || in_array($output['response2'], $bad_resp2) || in_array($output['response3'], $bad_resp3)) {
Header("Location: fail.php");
}
I get the following error(s):
Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\site\xyz.php on line 362
Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\site\xyz.php on line 362
Warning: in_array() expects parameter 2 to be array, null given in C:\xampp\htdocs\site\xyz.php on line 362