I have a form that has checkboxes like these:
<input type='checkbox' name='yourgame[]' value='soccer' /> Soccer<br>
<input type='checkbox' name='yourgame[]' value='tennis' /> Tennis<br>
<input type='checkbox' name='yourgame[]' value='basketball' /> Basketball<br>
In the php script, we get the values:
$yourgame = $_POST['yourgame'];
And there is validation:
if (empty($yourgame))
echo "Tick at least one Game.";
We keep getting the error message "Tick at least one Game." despite ticking several boxes. It seems the $yourgame[] array is not recognized.
I've also tried $yourgame = (array)$_POST['yourgame'];
no success.