title: PHP post foreach value to seperate array
body: <p>So...
  I have this foreach loop with information about a product and I want to save the information to a seperate array for each loop.</p>
  
  <p>I was thinking of doing something like this: </p>
  
  <pre><code>$return_array = array();
  foreach($items as $item) {
     $return_array[] = $item;
  }
  </code></pre>
  
  <p>But I have troubles doing it like this since I am using input values from html and I need to add those before they get send to a database.</p>
  
  <p>My foreach goes like:</p>
  
  <pre><code>foreach($items as $item) {
  &lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;input value="&lt;?= $item-&gt;name ?&gt;" name="item&lt;?= $item-&gt;id ?&gt;"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  ... more table tags
  &lt;?php foreach($item as $key) { ?&gt;
    &lt;input name ="item&lt;?= $item-&gt;id ?&gt;_label&lt;?= $key-&gt;label ?&gt; 
  &lt;?php } ?&gt;
  ... more table tags
  &lt;select name="item&lt;?= item-&gt;id ?&gt;_status&gt;
    //Choose the state the product is in
    &lt;option value="damaged"&gt;
    &lt;option value="good"&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>So after this gets submitted with the form (this is in a  btw) I get something like this:</p>
  
  <p>(depending on how many labels the product has this number can increase)</p>
  
  <pre><code>$array = 
  ['item1'] = 'test';
  ['item1_label1'] = 123;
  ['item1_label2'] = 213; 
  ['item1_status'] = 'good';
  ['item2'] = 'test2';
  ['item2_label1'] = 112;
  ['item2_label2'] = 1232;
  ['item2_label3'] = 132;
  ['item2_status'] = 'broken';`
  </code></pre>
  
  <p>Now what I want would be:</p>
  
  <pre><code>$array = 
    ['item1'] = array[   //name of this doesn't matter
      ['item1'] = 'test'; // name
      ['item1_label1'] = 123; //label
      ['item1_label2'] = 213;  //label
      ['item1_status'] = 'good'; //status
    ],
    ['item2'] = array[
      ['item2'] = 'test2'; //name
      ['item2_label1'] = 112; //label
      ['item2_label2'] = 1232; //label
      ['item2_label3'] = 132; //label
      ['item2_status'] = 'broken' //status
    ]
  ];
  </code></pre>
  
  <p>I want to create this information from the form. (also the number of items can increase).</p>