title: How To Insert Data Using Multiple Input With Same Name in codeigniter
body: <p>I'm using JavaScript would produce the following entries</p>
  
  <pre><code>&lt;input type="hidden" name="my_img[]" value="dad6e52b274690409835.jpg"&gt;
  &lt;input type="hidden" name="my_img[]" value="252529b6e21f872c7675.jpg"&gt;
  &lt;input type="hidden" name="my_img[]" value="3cce4128c366216fsfaf.jpg"&gt;
  &lt;input type="hidden" name="my_img[]" value="48697e8516caa3cc15d4.jpg"&gt;
  </code></pre>
  
  <p>But I've had trouble inserting them in the database</p>
  
  <p>my controllers :</p>
  
  <pre><code>   $dd=$this-&gt;input-&gt;post('my_img');
     for($i=0;$i&lt;count($dd);$i++)
     {
     $img_box[$i] = array ('img_url' =&gt; $dd[$i]);
     }
     $this-&gt;posts_model-&gt;add_new_ads_img($img_box);
  </code></pre>
  
  <p>my model :</p>
  
  <pre><code>public function add_new_ads_img($img_box)
  {
      $q = $this-&gt;db-&gt;insert('advertise_gallery',$img_box);
      if ($q)
      {
          return TRUE;
      }
      else return FALSE;
  }
  </code></pre>
  
  <p>And to eat error</p>
  
  <p>Severity: Notice</p>
  
  <p>Message: Undefined variable: img_box</p>
  
  <p>Please guide me</p>