Re: [PHP] Dynamic Array Index using Variable

2006-01-09 Thread Al
Chris Lott wrote: What I have is a form with 45 data fields... if any of a selected 35 of those fields is empty, I want to have the user go back. So I can't loop over the entire _POST array. So I thought I would put the names of the fields I *do* want to check into an array and check. So this wo

Re: [PHP] Dynamic Array Index using Variable

2006-01-09 Thread Chris Lott
What I have is a form with 45 data fields... if any of a selected 35 of those fields is empty, I want to have the user go back. So I can't loop over the entire _POST array. So I thought I would put the names of the fields I *do* want to check into an array and check. So this won't work: > foreach(

Re: [PHP] Dynamic Array Index using Variable

2006-01-09 Thread Al
Jim Moseby wrote: 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] == '') { $erro

RE: [PHP] Dynamic Array Index using Variable

2006-01-09 Thread Jay Paulson \(CE CEN\)
You could use the isset() or the empty() functions. http://us3.php.net/manual/en/function.empty.php http://us3.php.net/manual/en/function.isset.php But do you want to check all the fields that are being submitted or just specific ones that you set in the $reqfields array? If you want to check a

RE: [PHP] Dynamic Array Index using Variable

2006-01-09 Thread Jim Moseby
> > 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] == '') { > $errorfl