title: Getting data from dynamic form - multi-field row
body: <p>Currently I am creating a form that has a option to add dynamically fields ( as rows with extra fields ). The generator is a table that just adds a  into a bootstrap wrapper. As you can see on the image below. Everything is working smooth, but I am quite clueless about the post POST programming, cause for now the var_dump seems to be messy and I am not quite sure what solution would be the best a) form the data in jquery while sending the data to php or b) merge the post data to a user array. Over all the desired output would be (PHP)</p>
  
  <pre><code>array()
  ['user1'] =&gt; 
        ['role'] =&gt; 'something'
        ['can_edit'] = &gt; 0
        ['can_read'] = &gt; 1
        ['can_execute'] = &gt; 1
        ['is_admin'] = &gt; 0
  </code></pre>
  
  <p>Just wondering how to achieve that, give me some hints. Besides - As you see "on" represents the is_checked so it will be 1 if its 0 its not present at all - but that's not a problem.</p>
  
  <p><a href="https://i.stack.imgur.com/58uYE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/58uYE.png" alt="enter image description here"></a></p>
  
  <p>The post var_dump </p>
  
  <pre><code>["user"]=&amp;gt;
    array(4) {
      [0]=&amp;gt;
      string(5) "user1"
      [1]=&amp;gt;
      string(5) "user2"
      [2]=&amp;gt;
      string(5) "user3"
      [3]=&amp;gt;
      string(5) "user4"
    }
    ["role"]=&amp;gt;
    array(4) {
      [0]=&amp;gt;
      string(9) "something"
      [1]=&amp;gt;
      string(9) "something"
      [2]=&amp;gt;
      string(9) "something"
      [3]=&amp;gt;
      string(9) "something"
    }
    ["can_edit"]=&amp;gt;
    array(4) {
      [0]=&amp;gt;
      string(2) "on"
      [1]=&amp;gt;
      string(2) "on"
      [2]=&amp;gt;
      string(2) "on"
      [3]=&amp;gt;
      string(2) "on"
    }
    ["can_read"]=&amp;gt;
    array(2) {
      [0]=&amp;gt;
      string(2) "on"
      [1]=&amp;gt;
      string(2) "on"
    }
    ["can_execute"]=&amp;gt;
    array(2) {
      [0]=&amp;gt;
      string(2) "on"
      [1]=&amp;gt;
      string(2) "on"
    }
    ["is_admin"]=&amp;gt;
    array(1) {
      [0]=&amp;gt;
      string(2) "on"
    }
  </code></pre>
  
  <p>My generator</p>
  
  <p>$(".addCF").click(function(){</p>
  
  <pre><code>$("#customFields").append('&lt;tr&gt;&lt;td&gt;'+sel[0].outerHTML+'&lt;/td&gt;&lt;td&gt;&lt;input class="form-control" type="text" name="role[]" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox" name="can_edit[]"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox" name="can_read[]"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox" name="can_execute[]"&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" class="mycheckbox" name="is_admin[]"&gt;&lt;/td&gt;&lt;td&gt;&lt;a href="javascript:void(0);" class="remCF"&gt;Remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;');
  $('.mycheckbox').iCheck({checkboxClass: 'icheckbox_square-blue',radioClass: 'iradio_square-blue'});
  </code></pre>
  
  <p>});</p>