Re: what am I doing wrong - error message?

From: Date: Fri, 02 May 2003 21:25:32 +0000
Subject: Re: what am I doing wrong - error message?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146204@lists.php.net to get a copy of this message
At 22:33 02.05.2003, Amanda McComb said: --------------------[snip]-------------------- >Ok, I got the last part working great. So I copied the code to use on an >identical form field, but I'm getting the following error: > > >Warning: Invalid argument supplied for foreach() in >/usr/local/packages/apache-1.3.27/htdocs/amccomb/prodev/customer_form.php >on line 582 This error is triggered when a null or a non-array variable is passed to the foreach() construct. > <? foreach( $_POST['org_type'] as $org_type_cd => $quantity){ Before executing this foreach() loop, make sure $_POST['org_type'] is not null, and is an array: if (is_array($_POST['org_type'])) foreach($_POST['org_type'] as $x => $y) { } -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#146204) next »