creating multidimensional array from single array
<p>i have a html form in which i use array like this (name="courts[]"). when it send data to php file i use foreeach loop to create multidimensional array for inserting records in mysql. In php file i write foreeach loop to iterate like this</p>

<pre><code>    $data = array();
    $i = 0;
    foreach ($court_name as $result)
    {
        $data[] = array(
            'court_name' =&gt; $result[0]
        );
        $i++;
    }
</code></pre>

<p>it display result this </p>

<pre><code> Array
 (
      [0] =&gt; Array
       (
            [court_name] =&gt; P
       )

      [1] =&gt; Array
      (
           [court_name] =&gt; S
      )

 )
</code></pre>

<p>instead of this</p>

<pre><code> Array
 (
      [0] =&gt; Array
       (
            [court_name] =&gt; Punjab
       )

      [1] =&gt; Array
      (
           [court_name] =&gt; Sindh
      )

 )
</code></pre>
