Dynamic Array Index using Variable

From: Date: Mon, 09 Jan 2006 20:31:22 +0000
Subject: Dynamic Array Index using Variable
Groups: php.general 
Request: Send a blank email to php-general+get-228363@lists.php.net to get a copy of this message
I want to do something like this to check if a variety of submitted form fields (crn, instructor, etc) have any value in them: $reqfields = array('crn', 'instructor'); $errorflag = 0; foreach ($reqfields as $field) { if ($_REQUEST[$field] == '') { $errorflag = 1; } } But I can't quite get the syntax right... help?? c

« previous php.general (#228363) next »