[PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread Shaun
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[] =

RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
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 =

RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread Chris W. Parker
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

RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
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

Re: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread Chris Edwards
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

Re: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread John W. Holmes
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