title: Retrieve all selected checkboxes in an array with each id name, and pass it to PHP
body: <p>I have a series of checkboxes as such:</p>
  
  <pre><code>&lt;input type="checkbox" id="checkbox35080"&gt;&lt;/td&gt;
  &lt;input type="checkbox" id="checkbox23000"&gt;&lt;/td&gt;
  &lt;input type="checkbox" id="checkbox5000"&gt;&lt;/td&gt;
  &lt;input type="checkbox" id="checkbox7000"&gt;&lt;/td&gt;
  &lt;input type="checkbox" id="checkbox65354"&gt;&lt;/td&gt;
  </code></pre>
  
  <p>where they can be all checked or not at the same time, as some one can be checked and others not.</p>
  
  <p>What I need to do is retrieve all the checked checkboxes in jQuery or Javascript, store their sub-string number as elements in an array, and pass this array to PHP.</p>
  
  <p>So I wrote this short example of code in order to print the PHP array when I pass it from jQuery :</p>
  
  <p><strong>jQuery code</strong></p>
  
  <pre><code>function foo()
  {
     var $substr = "checkbox";
     var $id = "";
     var $checkedBoxes = new Array();
  
     $("input:checkbox[name=type]:checked").each(function()
     { 
        $id = $(this).attr('id');
        checkedBoxes.push($id.substring($substr.length));
     });
  
     $("#content").load("file.php", {checkboxes: $checkedBoxes});
  }
  </code></pre>
  
  <p><strong>PHP code</strong> in <strong>file.php</strong></p>
  
  <pre><code>&lt;?php
  if(isset($_POST["checkboxes"]))
  {
     $checkboxes = json_decode($_POST["checkboxes"], true);
     print_r($checkboxes);
  }
  ?&gt;
  </code></pre>
  
  <p>But I can't see the array printed on output.
  I also tried using <strong>$_REQUEST</strong> &amp; <strong>$_GET</strong> methods. No way, and I don't know what I am doing wrong (I don't think jQuery is my best).</p>
  
  <p>How can I achieve this task? What's wrong in my code?</p>
  
  <p>Thank you in advance for your help.</p>