RE: [PHP] Surpressing a 'foreach' Error Message
| From: | craig | Date: | Fri, 06 Feb 2004 22:24:14 +0000 |
| Subject: | RE: [PHP] Surpressing a 'foreach' Error Message | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177056@lists.php.net to get a copy of this message | ||
> Hi,
>
> I have some check boxes in a form and when the form is
> submitted I read the
> checkboxes that have been ticked. However if no checkboxes
> have been ticked
> the following line produces an error, is there a way to suppress this?
>
if (is_array($project))
> foreach ($project as $project_id => $value) {
> $fields[] = $project_id;
> $values[] = $value;
> }
>
if (is_array($project))
foreach ($project as $project_id => $value) {
$fields[] = $project_id;
$values[] = $value;
}
}
HTH,
Craig