title: Codeigniter Form with multiple insert row
body: <p>I want to add multiple rows with multiple duplicated forms, im stucked at the model. </p>
  
  <p>1# I add player, player can have 1 or N jobs. </p>
  
  <p>2# When creating a player you may add 1 or many jobs in the same form. By default I only show 1 input for 1 job, but if you click in the button a new input shows up to fill up a new job for that new player.</p>
  
  <p>My view:</p>
  
  <pre><code>Name&lt;input type="text" name="name" value="&lt;?php echo set_value('name'); ?&gt;" /&gt;
  
  Jobs&lt;input type="text" name="jobs[0]" value="&lt;?php echo set_value('jobs[0]'); ?&gt;" /&gt;
  
  &lt;button id="add_job"&gt;Add new job&lt;/button&gt;
  
  &lt;!-- if button click, jquery add new input --&gt;
  Jobs 2&lt;input type="text" name="jobs[1]" value="&lt;?php echo set_value('jobs[1]'); ?&gt;" /&gt;
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('name', 'name', 'trim|required|min_length[3]|max_length[64]');
  $this-&gt;form_validation-&gt;set_rules('jobs[]', 'job', 'trim|required|min_length[3]|max_length[64]');
  
  ...
  
  $this-&gt;players_model-&gt;create_player($img['file_name'])
  </code></pre>
  
  <p>My model:</p>
  
  <pre><code>function create_player($pic)
  {
      $new_member_insert_data = array(  
          'name' =&gt; $this-&gt;input-&gt;post('name'),
          'pic' =&gt; $pic
      );
      $insert = $this-&gt;db-&gt;insert('players', $new_member_insert_data);
      $id_player = $this-&gt;db-&gt;insert_id();
  
      // problem starts here
      $new_member_insert_jobs = array();
  
      //for() {
          $new_member_insert_jobs [] = array(
              'id_player' =&gt; $id_player,
              'job' =&gt; $this-&gt;input-&gt;post('jobs')[]
          );
      //}
      $this-&gt;db-&gt;insert_batch( 'estudios', $new_member_insert_jobs );
  </code></pre>