The markup for the flag looks like this:
<input type="checkbox" value="myvalue" name="validate[]">
When you post the form, you will see an array named validate in $_POST .
If this array is empty, the check box is not selected. If this array contains "myvalue", then the checkbox has been checked.
If you are dealing with multiple flags, for example:
<input type="checkbox" value="myvalue1" name="validate[]"> <input type="checkbox" value="myvalue2" name="validate[]">
Your script should know that the validate array in $_POST can contain the values myvalue1 and myvalue2 . Then you can look at $_POST['validate'] , and if the value exists in the array, then this check box is selected. You can use array_diff() to easily do this without writing any loops.
source share