title: Validating multiple check boxes with different names to make sure at least 1 is checked
body: <p>I have a PHP form with several check boxes (not groups) with different names that when submitted get sent to an array and emailed. The problem I am having is that I am looking for a way to validate that at least one of the check boxes is checked upon submit. I know how to do one check box or to do check box groups but not this. How can this be done? If someone could point me in the right direction I would be grateful.</p>
  
  <p>I am adding the code for the section of the form I am asking about.</p>
  
  <pre><code>  &lt;form action="" method="post"&gt;
  
  
  
     &lt;fieldset&gt;
          &lt;legend&gt;
              Please Select at least one:
          &lt;/legend&gt;
   &lt;p class="style5"&gt;Type of Alleged Occurrence:&lt;input name="occurrence" type="hidden"    value="&lt;?php { print 'Type of Occurrence'; }?&gt;"&gt;&lt;/p&gt;
                              &lt;font size="-1"   face="Arial, Helvetica, sans-serif" align="left"&gt;
                              &lt;table style="width: 100%"&gt;
                                  &lt;tr&gt;&lt;td   style="width: 21%; height: 57px;"&gt;&lt;strong&gt; Disruption:&lt;/strong&gt;&lt;br&gt;&lt;input name="obscene"   type="checkbox" value="Obscene Language" &lt;?php if(isset($_POST['obscene'])) echo "checked"; ?&gt;&gt;&lt;label  id="obscene"&gt;Obscene language &lt;/label&gt;
                                      &lt;/td&gt;&lt;td   style="width: 33%; height: 57px;"&gt;
                                      &lt;strong&gt; Sexual Harassment:&lt;/strong&gt;&lt;br&gt;&lt;input name="sexharass" type="checkbox" value="Physical" &lt;?php if(isset($_POST['sexharass'])) echo "checked"; ?&gt;  &gt;&lt;label  id="sexharass"&gt;Physical &lt;/label&gt;&amp;nbsp;&lt;span lang="en-us"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                                      &lt;/span&gt;&amp;nbsp;&lt;input name="sexharass" type="checkbox" value="Verbal" &lt;?php if(isset($_POST['sexharass'])) echo "checked"; ?&gt; &gt;&lt;label  id="sexharass2"&gt;Verbal &lt;/label&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;td  style="width: 21%; height: 57px;"&gt;&lt;strong&gt; Altercation:&lt;/strong&gt;
  &lt;br&gt;&lt;input name="altercation1" type="checkbox" value="Verbal" &lt;?php if(isset($_POST['altercation1'])) echo "checked"; ?&gt;&gt;&lt;label id="Label3"&gt;Verbal&lt;/label&gt;
  
   &lt;input name="altercation1" type="checkbox" value="Physical" &lt;?php   if(isset($_POST['altercation1'])) echo "checked"; ?&gt; &gt;&lt;label id="Label4"&gt;Physical&lt;/label&gt; &lt;br&gt;
  
  
  
                                      &lt;td    style="width: 33%; height: 57px;"&gt;&lt;strong&gt;Involved in altercation:&lt;/strong&gt;&lt;br&gt;
  
  
  
   &lt;input name="altercation2" type="checkbox" value="student/student" &lt;?php if(isset($_POST['altercation2'])) echo "checked"; ?&gt;&gt;&lt;label id="Label3"&gt;Student/Student &lt;/label&gt;
  
  
  &lt;input name="altercation2" type="checkbox" value="student/faculty-staff" &lt;?php if(isset($_POST['altercation2'])) echo "checked"; ?&gt;&gt;&lt;label id="Label4"&gt;Student/Faculty-Staff &lt;/label&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;&lt;strong&gt; Theft/ Damage to Property:&lt;/strong&gt;&lt;br&gt;&lt;input name="property" type="checkbox" value="DACC" &lt;?php if(isset($_POST['property'])) echo "checked"; ?&gt;  &gt;&lt;label  id="property"&gt;DACC &lt;/label&gt;&amp;nbsp;&lt;span lang="en-us"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size="-1" face="Arial, Helvetica, sans-serif" align="left"&gt;&lt;input name="property1" type="checkbox" value="Self" &lt;?php if(isset($_POST['property'])) echo "checked"; ?&gt; &gt;&lt;label  id="property3"&gt;Self &lt;/label&gt;
  
  
  
  &lt;/font&gt;&amp;nbsp;&amp;nbsp;&lt;br&gt;
                                      &lt;/span&gt;&lt;input name="property" type="checkbox" value="Faculty/Staff" &lt;?php if(isset($_POST['property'])) echo "checked"; ?&gt; &gt;&lt;label  id="property2"&gt;Faculty/Staff &lt;/label&gt;
  
  
  
  
    &lt;/td&gt;
     &lt;td&gt;&lt;strong&gt; Threat of Harm to Self or Others:&lt;/strong&gt;&lt;br&gt;&lt;input name="harm" type="checkbox" value="Student/Student" &lt;?php if(isset($_POST['harm'])) echo "checked"; ?&gt;  &gt;
  &lt;label  id="harm"&gt;Student/Student &lt;/label&gt;&amp;nbsp;&lt;span lang="en-us"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size="-1" face="Arial, Helvetica, sans-serif" align="left"&gt;&lt;input name="harm2" type="checkbox" value="Self" &lt;?php if(isset($_POST['harm'])) echo "checked"; ?&gt; &gt;&lt;label  id="property2"&gt;Self &lt;/label&gt;
  
  
  
  &lt;/font&gt;&lt;br&gt;
                                      &lt;/span&gt;
              &lt;font size="-1" face="Arial, Helvetica, sans-serif" align="left"&gt;
                              &lt;span lang="en-us"&gt;&lt;input name="harm1" type="checkbox" value="Student/Faculty-Staff" &lt;?php if(isset($_POST['harm'])) echo "checked"; ?&gt; &gt;&lt;label  id="harm3"&gt;Student/Faculty-Staff &lt;/label&gt;
  
  
  
              &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
  
  
  &lt;tr&gt;&lt;td&gt;&lt;strong&gt; Drugs/Alcohol:&lt;/strong&gt;&lt;br&gt;&lt;input name="drugs" type="checkbox" value="Under the Influence" &lt;?php if(isset($_POST['drugs'])) echo "checked"; ?&gt;  &gt;&lt;label  id="drugs"&gt;Under the Influence &lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size="-1" face="Arial, Helvetica, sans-serif" align="left"&gt;&lt;input name="drugs" type="checkbox" value="Possession" &lt;?php if(isset($_POST['drugs'])) echo "checked"; ?&gt; &gt;&lt;label  id="drugs2"&gt;Possession &lt;/label&gt;
  
  
  
  &lt;/font&gt;
  
  
  
  
     &lt;/td&gt;&lt;td&gt;&lt;strong&gt; Other Occurrences:&lt;/strong&gt;&lt;br&gt;&lt;input name="other" type="checkbox" value="Student/Student" &lt;?php if(isset($_POST['other'])) echo "checked"; ?&gt;  &gt;&lt;label  id="other"&gt;Trespassing &lt;/label&gt;&amp;nbsp;&lt;span lang="en-us"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size="-1" face="Arial, Helvetica, sans-serif" align="left"&gt;&lt;input name="other" type="checkbox" value="Other" &lt;?php if(isset($_POST['other'])) echo "checked"; ?&gt; &gt;&lt;label  id="other2"&gt;Other &lt;/label&gt;
  
  
  
  &lt;/font&gt;&lt;br&gt;
                                      &lt;/span&gt;
              &lt;/td&gt;&lt;/tr&gt;              &lt;/table&gt;&lt;p&gt;&lt;/p&gt;
  </code></pre>