note 33742 added to function.in-array

From: Date: Sun, 06 Jul 2003 08:20:32 +0000
Subject: note 33742 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-51577@lists.php.net to get a copy of this message
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 ..." ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33742 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33742&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33742&report=yes

« previous php.notes (#51577) next »