title: separating tables values into different cells
body: <p>So I have started to get to grip with using fpdf but one thing I am not sure about is separating array values onto difference cells in the pdf form. </p>
  
  <p>This is the part of the form that I am having issues with. The form itself is okay and goes through my php file.</p>
  
  <pre><code>&lt;table class="qualifications" id="qualifications" &gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;b&gt;Date From&lt;/b&gt;&lt;/td&gt;
    &lt;td&gt;&lt;b&gt;Date To&lt;/b&gt;&lt;/td&gt;
    &lt;td&gt;&lt;b&gt;Name of School/College/Institute or Professional Body&lt;/b&gt;&lt;/td&gt;
    &lt;td&gt;&lt;b&gt;Examinations Taken and Results&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;input type="text" name="date_from[]" id="date_from" /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="date_to[]" id="date_to"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="school_name[]" id="school_name" /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="results[]" id="results"/&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;a href="#" title="" class="add-row"&gt;Add Row&lt;/a&gt;
  </code></pre>
  
  <p>The user is able to add as many rows as they like using the add row link</p>
  
  <p>This is how I get the values from the table:</p>
  
  <pre><code>if( isset($_POST['date_from']) &amp;&amp; is_array($_POST['date_from']) ) {
      $from = implode(', ', $_POST['date_from']);
  
  }
  
  if( isset($_POST['date_to']) &amp;&amp; is_array($_POST['date_to']) ) {
      $to = implode(', ', $_POST['date_to']);
  
  }
  
  if( isset($_POST['school_name']) &amp;&amp; is_array($_POST['school_name']) ) {
      $schoolName = implode(', ', $_POST['school_name']);
  
  }
  
  if( isset($_POST['results']) &amp;&amp; is_array($_POST['results']) ) {
      $examResults = implode(', ', $_POST['results']);
  
  }
  </code></pre>
  
  <p>When it comes to populating the cell in the pdf form I have been doing something like:</p>
  
  <pre><code> $pdf-&gt;Cell($width_cell[0],10,$from,1,0,'C'); 
  </code></pre>
  
  <p>But this just keeps each value entered into the table in one cell</p>
  
  <p>Say for example if someone had entered 2 rows into the qualifications table and the date from values were:</p>
  
  <p>22/09/2002 and 10/10/18</p>
  
  <p>These would just display on the same cell as 22/09/12, 10/10/18</p>
  
  <p>So how would I go about changing it so that the second value and so on would go beneath the first cell instead?</p>
  
  <p>Hope this made sense</p>
  
  <p>Edit: This is how I am now populating the cells:</p>
  
  <pre><code>  $width_cell=array(30,25,50,90);
  
  $pdf-&gt;Cell($width_cell[0],10,'Date From',1,0); // First header column 
  $pdf-&gt;Cell($width_cell[1],10,'Date To',1,0); // Second header column
  $pdf-&gt;Cell($width_cell[2],10,'Name of School',1,0); // Third header column 
  $pdf-&gt;Cell($width_cell[3],10,'Examinations Taken &amp; Results',1,1); // Fourth header column
  
    $pdf-&gt;SetFont('Arial','',10);
   foreach ($from as $point =&gt; $data) {
   $pdf-&gt;Cell($width_cell[0],10,$data,1,1,'C');
  
  }
  
   foreach ($to as $point =&gt; $data) {
      $pdf-&gt;Cell($width_cell[1],10,$data,1,1,'C');
  
   }
  
   foreach ($schoolName as $point =&gt; $data) {
      $pdf-&gt;Cell($width_cell[2],10,$data,1,1,'C');
  
   }   
  
  
   foreach ($examResults as $point =&gt; $data) {
      $pdf-&gt;Cell($width_cell[3],10,$data,1,1,'C');    
  
   }
  </code></pre>
  
  <p>Edit 2: I have now got it working, I changed the way I populated the cells to:</p>
  
  <pre><code>$pdf-&gt;Cell($width_cell[0],10,'Date From',1,0); // First header column 
  $pdf-&gt;Cell($width_cell[1],10,'Date To',1,0); // Second header column
  $pdf-&gt;Cell($width_cell[2],10,'Name of School',1,0); // Third header column 
  $pdf-&gt;Cell($width_cell[3],10,'Examinations Taken &amp; Results',1,1); // Fourth header column
  
    $pdf-&gt;SetFont('Arial','',10);
   foreach ($from as $point =&gt; $data) {
    $pdf-&gt;Cell($width_cell[0],10,$data,1,0,'C'); 
    $pdf-&gt;Cell($width_cell[1],10,$to[$point],1,0,'C');
    $pdf-&gt;Cell($width_cell[2],10,$schoolName[$point],1,0,'C');
    $pdf-&gt;Cell($width_cell[3],10,$examResults[$point],1,1,'C');
  
  
  }
  </code></pre>