title: How to get multiple input values with PHP when name attributes are the same?
body: <p>I would like to know how to get the input value from all my input fields if all inputs have the same name attribute. I'm also using the FPDF library and I need to insert every value in different cells. This is the code...</p>
  
  <pre class="lang-php prettyprint-override"><code>$pieces = explode(" ", $description);
  
  foreach ($_POST as $key=&gt;$description) {
  
      if (substr($key,0,6) === "field_"){
          $pdf-&gt;Cell(100,10, "$description", 1, 0, "L");
          $pdf-&gt;Cell(25,10,"$description",1,0,"C");
          $pdf-&gt;Cell(25,10,"$ $description",1,0,"L");
          $pdf-&gt;Cell(0,10,"$ $description",1,1,"L");
      }
  }
  </code></pre>
  
  <p>My HTML is the following:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="input_fields_wrap" id="input_fields"&gt;
      &lt;div class="new"&gt;
          &lt;input class="description" maxlength="255" name="field_0" placeholder="Enter Description" type="text" value=""&gt;
          &lt;input class="rate qty" data-rate="rate" maxlength="255" name="field_0" placeholder="0" size="5" type="text" value=""&gt;
          &lt;input class="pack price" data-price="price" maxlength="255" name="field_0" placeholder="$ 0.00" size="5" type="text" value=""&gt;
          &lt;input class="amount" id="amount" name="field_0" type="text"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As you can see in my PHP I even used the explode function but I don't get good results.</p>
  
  <p>This is before the PDF</p>
  
  <p><a href="https://i.stack.imgur.com/4U3sy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4U3sy.jpg" alt="This is before the PDF"></a></p>
  
  <p>And this is what the PDF looks like</p>
  
  <p><a href="https://i.stack.imgur.com/1FdKk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1FdKk.jpg" alt="And this is what the PDF looks like"></a></p>
  
  <p>Thank you!.</p>