title: Update multiple rows with same id using foreach loop
body: <p>I echo 2 input-fields (2 db columns) foreach row in the database (where id=$id) with each row's data being inside the input field. Admin-user can change data inside input-field and click update. </p>
  
  <p>Currently, when clicking the update-button, it does update the rows (where id=$id) but it updates each row with the input-data of the first input field instead of updating input-data foreach input field. Thank you in advance for help.</p>
  
  <p>view:</p>
  
  <pre><code>&lt;form action='&lt;?= site_url("admin/do_edit_page"); ?&gt;' method='POST'&gt;
      &lt;?php foreach($link_data as $row) : ?&gt;
          Link:&lt;br /&gt;
          &lt;input type='text' name='page_link_title' value='&lt;?= $row-&gt;link_title; ?&gt;'&gt;
          &lt;input type='text' name='page_link_sub_title' value='&lt;?= $row-&gt;link; ?&gt;'&gt;&lt;br /&gt;
      &lt;?php endforeach; ?&gt;
  
          &lt;input type='submit' name='update_site' value='Update'&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>public function do_edit_page(){
      $id = $this-&gt;input-&gt;post('page_id', TRUE);
      $this-&gt;content_model-&gt;update_links($id);
  }
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>public function update_links($id){
      foreach($_POST as $update_rows){
          $update_rows = array(
              array(
                'page_id' =&gt; $id,
                'link_title' =&gt; $this-&gt;input-&gt;post('page_link_title', TRUE),
                'link' =&gt; $this-&gt;input-&gt;post('page_link_sub_title', TRUE)  
              )
          );
          $this-&gt;db-&gt;update_batch('content_links', $update_rows, 'page_id');  
      }  
  }
  </code></pre>