How to make validation of data from an array? Here is an example of how I am doing:
The form:
<form class="" action="index.php" method="post"> <input type="text" name="code" placeholder="Enter nubmer"> <input type="submit" value="code" class="button"> </form>
PHP code:
$_POST = $code; $code = array("CodeOne", "CodeTwo", "CodeThree", "CodeFour"); if (in_array('', $code)) { echo "Nice! Product is verification!"; } else (in_array('', $code)) { echo "Oh, no! Product is not verification!"; }
$code
array, all that came from the post, you need to do $ code = $ _POST, and not vice versa. and what do you want to do with this?$code = array("CodeOne", "CodeTwo", "CodeThree", "CodeFour");
? From the example, you can get only$_POST['code']
- ddeadlink