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?
foreach ($project as $project_id = $value) {
$fields[] =
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 =
craig mailto:[EMAIL PROTECTED]
on Friday, February 06, 2004 2:24 PM said:
if (is_array($project))
foreach ($project as $project_id = $value) {
$fields[] = $project_id;
$values[] = $value;
}
}
you're missing a curly brace after the if ().
--
PHP General Mailing List
craig mailto:[EMAIL PROTECTED]
on Friday, February 06, 2004 2:24 PM said:
if (is_array($project))
foreach ($project as $project_id = $value) {
$fields[] = $project_id;
$values[] = $value;
}
}
you're missing a curly brace after the if ().
my bad, that's what
The is_array will still give a warning is the variable array does not exist.
Use isset()
- Original Message -
From: craig [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, February 06, 2004 5:35 PM
Subject: RE: [PHP] Surpressing a 'foreach' Error Message
craig mailto:[EMAIL
craig wrote:
craig mailto:[EMAIL PROTECTED]
on Friday, February 06, 2004 2:24 PM said:
if (is_array($project))
foreach ($project as $project_id = $value) {
$fields[] = $project_id;
$values[] = $value;
}
}
you're missing a curly brace after the if ().
my bad, that's what you get
6 matches
Mail list logo