-
-
Save ildarkhasanshin/bfb6a55b1e6b2f099c903ad2b2d8a12c to your computer and use it in GitHub Desktop.
HTML Multi checkbox set – the correct way to group checkboxes
http://www.wastedpotential.com/html-multi-checkbox-set-the-correct-way-to-group-checkboxes/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="checkbox" name="chk_group[]" value="value1" />Value 1<br /> | |
<input type="checkbox" name="chk_group[]" value="value2" />Value 2<br /> | |
<input type="checkbox" name="chk_group[]" value="value3" />Value 3<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['chk_group'])) { | |
$optionArray = $_POST['chk_group']; | |
for ($i=0; $i<count($optionArray); $i++) { | |
echo $optionArray[$i]."<br />"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment