Search code examples
phpcheckboxisset

Php form isset with multiple brackets


I have a check box with a name of:

<input type='checkbox' name ='schedule[".$row['id']."][1]' />

I want to check if the check box was checked with the PHP isset(...) And I tried it as

isset($_POST['schedule[".$row['id']."][1]]);

But this didn't work. Any ideas that how It can works?


Solution

  • Try it like:

    isset($_POST['schedule'][$row['id']][1])
    

    Simply treat it as multi-D array in this case and edit particular index of schedule key.