Hey guys. I am using the function array_search to see if a value excists in an array however it doesn't seem to be working.
Here is how I ma using it
$lanceArray=array(1 =>"Arkansas",1 =>"Iowa",1 =>"Kansas",1 =>"Louisiana",1 =>"Minnesota",1 =>"Missouri",1 =>"Nebraska",1 =>"North Dakota",1 =>"Oklahoma",1 =>"South Dakota",1 =>"Texas",1 =>"Wisconsin");
if(array_search($_POST['selState'], $lanceArray)){
echo "lance";
}
I cannot get this to respond in any way. All the keys are 1 simply because I do not care what the key is, I just need to return a value to see if it excists in the array.
I have made sure that one of the values in the array are being passed, but still nothing.
Am I using this function incorectly?
Thanks!🙂