Multi Sub Array In Php
<p>i have a input <code>elements</code> as below</p>

<pre><code>        &lt;form method="post" &gt;
1       &lt;input type="text" name="passname[name]" /&gt; &lt;br/&gt; &lt;br/&gt;
2       &lt;input type="text" name="passname[type]" /&gt; &lt;br/&gt; &lt;br/&gt;
3       &lt;input type="text" name="passname[age]" /&gt; &lt;br/&gt; &lt;br/&gt;

1       &lt;input type="text" name="passname[name]" /&gt; &lt;br/&gt; &lt;br/&gt;
2       &lt;input type="text" name="passname[type]" /&gt; &lt;br/&gt; &lt;br/&gt;
3       &lt;input type="text" name="passname[age]" /&gt; &lt;br/&gt; &lt;br/&gt;

        &lt;input type="submit" name="send" value="Submit" /&gt; &lt;br/&gt;
    &lt;/form&gt;
</code></pre>

<p>i want all the <code>text box</code> as array in <code>php</code> </p>

<p>like Below</p>

<pre><code>Passenger Name : passname[name]
Passenger Type : passname[type]
Passenger Age : passname[age]
</code></pre>

<p>Is this possible with php</p>

<p>form code used in form</p>

<pre><code>&lt;input type="text" name="passname[name][]" /&gt; &lt;br/&gt; &lt;br/&gt;
&lt;input type="text" name="passname[type][]" /&gt; &lt;br/&gt; &lt;br/&gt;
&lt;input type="text" name="passname[age][]" /&gt; &lt;br/&gt; &lt;br/&gt;

&lt;input type="text" name="passname[name][]" /&gt; &lt;br/&gt; &lt;br/&gt;
&lt;input type="text" name="passname[type][]" /&gt; &lt;br/&gt; &lt;br/&gt;
&lt;input type="text" name="passname[age][]" /&gt; &lt;br/&gt; &lt;br/&gt;
</code></pre>

<p>when i submit the form i get this type of array value </p>

<pre><code>    array
  'passname' =&gt; 
        array
          'name' =&gt; 
            array
              0 =&gt; string '1' (length=1)
              1 =&gt; string '1' (length=1)
          'type' =&gt; 
            array
              0 =&gt; string '2' (length=1)
              1 =&gt; string '2' (length=1)
          'age' =&gt; 
            array
              0 =&gt; string '3' (length=1)
              1 =&gt; string '3' (length=1)
      'send' =&gt; string 'Submit' (length=6)
</code></pre>

<p>how can i do it in for each like blow</p>

<pre><code>&lt;?php
if(isset($_POST['aa']))
{
    $number = $_POST['1'];
    $text = $_POST['2'];
    foreach($number as $key=&gt;$val)
    {
        echo $val."=".$text[$key]."&lt;br /&gt;";
    }
}
?&gt;
&lt;formid="a"name="a"method="post"&gt;
&lt;selectid="1[]"name="1[]"&gt;
&lt;optionvalue="1"&gt;1&lt;/option&gt;
&lt;optionvalue="3"&gt;3&lt;/option&gt;
&lt;optionvalue="2"&gt;2&lt;/option&gt;
&lt;/select&gt;
&lt;inputtype="text"value=""id="2[]"name="2[]"/&gt;
&lt;selectid="1[]"name="1[]"&gt;
&lt;optionvalue="1"&gt;1&lt;/option&gt;
&lt;optionvalue="3"&gt;3&lt;/option&gt;
&lt;optionvalue="2"&gt;2&lt;/option&gt;
&lt;/select&gt;
&lt;inputtype="text"value=""id="2[]"name="2[]"/&gt;
&lt;inputtype="submit"id="aa"name="aa"value="send now"/&gt;
&lt;/form&gt;
</code></pre>
