title: inserting form data into a pdf file
body: <p>I am inserting form data into a pdf file using php, I am looping through the form data using a foreach loop, the problem is that the submit button value is also inserted into the pdf file, which I do not want this to happen. is it also possible to insert the labels for the form inputs into the pdf file. also, I have only used two input fields in the example but I have a lot more that's why I am using a loop. </p>
  
  <p>form </p>
  
  <pre><code>    &lt;?php require 'pdf.php';?&gt;
      &lt;form action="#" method="post"&gt;
          &lt;label for="fname"&gt;First Name:&lt;/label&gt; &lt;input type="text" name="fname" placeholder="First Name"&gt;
  &lt;label for="lname"&gt;Last Name&lt;/label&gt; &lt;input type="text" name="lname" placeholder="Last Name"&gt;
          &lt;input type="submit" value="Submit" name="submit"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>pdf </p>
  
  <pre><code>&lt;?php require('fpdf.php');?&gt;
  &lt;?php
  if(isset($_POST['submit'])) {
  
  
  $pdf = new FPDF();
  $pdf-&gt;AddPage();
  
  foreach ($_POST as $key =&gt; $data) {
  
  $pdf-&gt;SetFont('Arial','B',16);
  $pdf-&gt;write(40,"$data");
  $pdf-&gt;ln(10);
  
  
  }
  $pdf-&gt;Output();
  }
  ?&gt;
  </code></pre>