note 33742 rejected from function.in-array by torben
| From: | torben@php.net | Date: | Sun, 06 Jul 2003 09:16:49 +0000 |
| Subject: | note 33742 rejected from function.in-array by torben | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-51578@lists.php.net to get a copy of this message | ||
Note Submitter: spam@r3m0v3_7h1s.samuraiwar.com
----
Be careful... This script was designed to check for required fields:
$required =
array('put','required','field','names','here');
foreach ($_POST as $k => $v) {
if ($v == '' && in_array($required, $k)) {
echo 'Empty field: ', $k, '<br>';
$missingfield = 'true';
}
}
Returns error, "Warning: in_array() [function.in-array]: Wrong datatype for second argument in
..."