title: Group multiple inputs to $_POST
body: <p>I can't figured out how to resolve this script:
  At the point 1 I need to have one $data array with one ingredient, amount and um</p>
  
  <p>Here is the html part:</p>
  
  <pre><code>...
  &lt;tr&gt;
    &lt;td&gt;&lt;input name="cantitate[1]" class="cantitate" /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;select name="unitate[1]"&gt;&lt;?=$display-&gt;selectAmount()?&gt;&lt;/select&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input name="ingredient[1]" class="ingredient" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  ...
  </code></pre>
  
  <p>Here is the php part:</p>
  
  <pre><code>// ingredients
  $ingredients = $_POST['ingredient'];
  $amount = $_POST['cantitate'];
  $um = $_POST['unitate'];
  
  foreach($_POST as $key =&gt; $value){ 
  
   $data = null;
   if(isset($_POST['ingredient']) &amp;&amp; !empty($_POST['ingredient']) &amp;&amp; $_POST['ingredient']!=''){
  
      if($key=='cantitate') $data['amount'] = $value;
      if($key=='unitate') $data['um'] = $value;
      if($key=='ingredient') $data['ingredient'] = $value;                    
  
      //var_dump($data);
      // point 1
      // here will be the function to add one ingredient with one um, and one amount
   }
  
  }
  </code></pre>
  
  <p>Thanks!</p>