У меня есть форма PHP с несколькими флажками (не группами) с разными именами, которые при отправке отправляются в массив и отправляются по электронной почте. Проблема, с которой я столкнулся, заключается в том, что я ищу способ проверить, установлен ли хотя бы один из флажков при отправке. Я знаю, как сделать один флажок или сделать флажок группы, но не это. Как это может быть сделано? Если бы кто-то мог указать мне правильное направление, я был бы благодарен.
Я добавляю код для раздела формы, о которой я спрашиваю.
<form action="" method="post">
<fieldset>
<legend>
Please Select at least one:
</legend>
<p class="style5">Type of Alleged Occurrence:<input name="occurrence" type="hidden" value="<?php { print 'Type of Occurrence'; }?>"></p>
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<table style="width: 100%">
<tr><td style="width: 21%; height: 57px;"><strong> Disruption:</strong><br><input name="obscene" type="checkbox" value="Obscene Language" <?php if(isset($_POST['obscene'])) echo "checked"; ?>><label id="obscene">Obscene language </label>
</td><td style="width: 33%; height: 57px;">
<strong> Sexual Harassment:</strong><br><input name="sexharass" type="checkbox" value="Physical" <?php if(isset($_POST['sexharass'])) echo "checked"; ?> ><label id="sexharass">Physical </label> <span lang="en-us">
</span> <input name="sexharass" type="checkbox" value="Verbal" <?php if(isset($_POST['sexharass'])) echo "checked"; ?> ><label id="sexharass2">Verbal </label>
<td style="width: 21%; height: 57px;"><strong> Altercation:</strong>
<br><input name="altercation1" type="checkbox" value="Verbal" <?php if(isset($_POST['altercation1'])) echo "checked"; ?>><label id="Label3">Verbal</label>
<input name="altercation1" type="checkbox" value="Physical" <?php if(isset($_POST['altercation1'])) echo "checked"; ?> ><label id="Label4">Physical</label> <br>
<td style="width: 33%; height: 57px;"><strong>Involved in altercation:</strong><br>
<input name="altercation2" type="checkbox" value="student/student" <?php if(isset($_POST['altercation2'])) echo "checked"; ?>><label id="Label3">Student/Student </label>
<input name="altercation2" type="checkbox" value="student/faculty-staff" <?php if(isset($_POST['altercation2'])) echo "checked"; ?>><label id="Label4">Student/Faculty-Staff </label>
<tr><td><strong> Theft/ Damage to Property:</strong><br><input name="property" type="checkbox" value="DACC" <?php if(isset($_POST['property'])) echo "checked"; ?> ><label id="property">DACC </label> <span lang="en-us"> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"><input name="property1" type="checkbox" value="Self" <?php if(isset($_POST['property'])) echo "checked"; ?> ><label id="property3">Self </label>
</font> <br>
</span><input name="property" type="checkbox" value="Faculty/Staff" <?php if(isset($_POST['property'])) echo "checked"; ?> ><label id="property2">Faculty/Staff </label>
</td>
<td><strong> Threat of Harm to Self or Others:</strong><br><input name="harm" type="checkbox" value="Student/Student" <?php if(isset($_POST['harm'])) echo "checked"; ?> >
<label id="harm">Student/Student </label> <span lang="en-us"> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"><input name="harm2" type="checkbox" value="Self" <?php if(isset($_POST['harm'])) echo "checked"; ?> ><label id="property2">Self </label>
</font><br>
</span>
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<span lang="en-us"><input name="harm1" type="checkbox" value="Student/Faculty-Staff" <?php if(isset($_POST['harm'])) echo "checked"; ?> ><label id="harm3">Student/Faculty-Staff </label>
</span></font></td></tr>
<tr><td><strong> Drugs/Alcohol:</strong><br><input name="drugs" type="checkbox" value="Under the Influence" <?php if(isset($_POST['drugs'])) echo "checked"; ?> ><label id="drugs">Under the Influence </label> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"><input name="drugs" type="checkbox" value="Possession" <?php if(isset($_POST['drugs'])) echo "checked"; ?> ><label id="drugs2">Possession </label>
</font>
</td><td><strong> Other Occurrences:</strong><br><input name="other" type="checkbox" value="Student/Student" <?php if(isset($_POST['other'])) echo "checked"; ?> ><label id="other">Trespassing </label> <span lang="en-us"> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"><input name="other" type="checkbox" value="Other" <?php if(isset($_POST['other'])) echo "checked"; ?> ><label id="other2">Other </label>
</font><br>
</span>
</td></tr> </table><p></p>