Here is a more efficient way but usually there are more than one checkboxes all with the same arrayname with either an index or a key. Since any number of boxes may be checked you need to name the checkbox as either an associative array or simple as an indexed array. e.g. <input type='checkbox' name = 'test[]' id = 'test[]' value = 'test'>Test or <input type='checkbox' name = 'test[test]' id = 'test[test]' value = 'test'>Test. So the value of $POST['test'][0] if checked would be test or if the second example $POST['test']['test'] would also be test. But using the way you are naming your checkboxes will not work an example is shown below in a simple form and a process file.
Form:
<html>
<body>
<form action="checkTest.php" method='post'>
<input type='checkbox' name ='test' id='test' value='test1' />test1
<input type='checkbox' name ='test' id='test' value='test2' />test2
<input type='checkbox' name ='test' id='test' value='test3' />test3
<input type='submit' />
</form>
</body>
</html>
checkTest.php
if(isset($_POST['test']))
{
echo $test = ($_POST['test']=='test1'?'Yes':'No');
echo $test = ($_POST['test']=='test2'?'Yes':'No');
echo $test = ($_POST['test']=='test3'?'Yes':'No');
}
echo $_POST['test'];
If you were to check all the boxes the output would be No No Yes and test3 not hardly what you would want with checkboxes. This is because the last indexed box checked takes the value of the name (which is the key). If you were to check box 1 and two then the output would be NO Yes NO test2