I have an HTML form in which I do that:

<input type="checkbox" name="category[ids][]" value="12" /> FOO<br/>
<input type="checkbox" name="category[ids][]" value="23" /> BAR<br/>

In the next page, I can access the array $category which has a depth of 2.
Among other things, I can access $category['ids'].
$category['sub_categories'] is another array, with chosen sub-categories for each category...
So you see, from a FORM, I get arrays, and not only simple variables.

BUT...
I works only if I do

$category = $_POST['category'];

before using my array variable.
Why can't I directly use

$_POST['category['ids']'] 

???
Is there a way to still use the $_POST variable with such arrays?

    try $_POST["category"]["ids"]

      Yeah thanks that works for me 🙂
      I'm glad I won't have to make some hacks here and there...

        Write a Reply...