Undefined index & Invalid argument supplied for foreach()
<p>I am struggling with generating an output if none of the check boxes are selected from the code below.</p>

<p>HTML - Form</p>

<pre><code>&lt;label&gt;Item 1:&lt;/label&gt;&lt;input type="checkbox" name="selected[]" value="Item 1"/&gt;
&lt;label&gt;Item 2:&lt;/label&gt;&lt;input type="checkbox" name="selected[]" value="Item 2"/&gt;
&lt;label&gt;Item 3:&lt;/label&gt;&lt;input type="checkbox" name="selected[]" value="Item 3"/&gt;
</code></pre>

<p>PHP Code</p>

<pre><code>&lt;?php
foreach ($_REQUEST['selected'] as $key =&gt; $selected) {
echo "$selected";           
}         
?&gt;
</code></pre>

<p>The code outputs the correct value when selected, but generates the "Undefined index: selected in..." &amp; "Invalid argument supplied for foreach():"</p>

<p>Can anyone point me in the right direction?
Thank you</p>
