On Wed, 08 Sep 2004 16:41:38 +0200, Daniel Kullik <[EMAIL PROTECTED]> wrote:
> Anthony Ritter wrote:
> > I get a:
> >
> > Warning: Invalid argument supplied for foreach() in
> > c:\apache\htdocs\or_6.4.php on line 15
> >
> > after submitting the form.
> >
>
> Hello Anthony!
>
> As long as you don't submit the form with a single option selected there
> will be no $_POST['lunch'], therefore foreach() won't be able to loop
> through it.
>
> Add the line print_r($_POST) to your code in order to see what actually
> happens if you hit the submit-button of your form.
>
>
> Daniel
>
And when you've found out about the cause of your problem and what to
get rid of the notice, do either one of the following
if (!(isset($_POST['lunch']) && is_array($_POST['lunch'])))
$_POST['lunch'] = Array();
---
if (isset($_POST['lunch']) && is_array($_POST['lunch']) foreach
($_POST['lunch'] as $choice) {
/* and the rest of your code */
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php