I have a input checkbox field, where its name generate dynamically using JavaScript.
<input type="checkbox" name="options_'.$j.'" class="check">
Now, I want to check whether any checkbox is checked or not in if condition. I have written the following code. But it is not working. Please help me to correct the code.
for($i = 0; $i<=1; $i++)
{
if(!isset($_POST['options_ '.$i]))
{
echo $error;
}
$i++;
}
Is this is the correct format?
$i++;for($i = 0; $i<=count($_POST); $i++) { if(!isset($_POST['options_ '.$i])) { echo $error; } }<input type="checkbox" name="options['.$j.']" class="check">in your HTML, now you can usecount ($_POST['options'])directly instead of this much code