title: How to get checkbox values in array in PHP?
body: <p>I have an image upload form that looks like this:
  <img src="https://i.stack.imgur.com/TedBl.png" alt="Gallery Screenshot"></p>
  
  <p>The code to generate tag checkboxes:</p>
  
  <pre><code>foreach($tag as $tagid =&gt; $tagname) {
    echo "&lt;label&gt;&lt;input type=\"checkbox\" name=\"img_tags[]\" value=\"".$tagid."\"&gt;".$tagname."&lt;/label&gt;";
  }
  </code></pre>
  
  <p>Then in PHP I want to read values of this checkboxes for each image. I want img_tags to be 2D array so I can loop over it and check values for each picture. Is this possible? </p>
  
  <p>Output of:</p>
  
  <pre><code>$img_tags = $_POST['img_tags'];↵
  foreach($img_tags as $t) {↵
      print_r($t);↵
  }↵
  </code></pre>
  
  <p>is: 12121, which I don't understand at all.</p>