title: outputting table using fpdf
body: <p>I am trying to output a table using <code>FPDF</code> and PHP.</p>
  
  <p>What I need is to output the table headings and I have a doctrine (symfony) collection. </p>
  
  <p>I'm using the <code>writeHTML</code> method using:</p>
  
  <pre><code>$pdf-&gt;writeHTML('&lt;table&gt;','','','','');
  $pdf-&gt;writeHTML('&lt;tr&gt;&lt;th&gt;Tooth Selection&lt;/th&gt;&lt;th&gt;Requirements&lt;/th&gt;&lt;th&gt;Shade&lt;/th&gt;&lt;th&gt;Cost&lt;/th&gt;&lt;/tr&gt;','','','','');
  $order_items = $this-&gt;order_details-&gt;getIncludedItemsOrders();
    foreach($order_items as $item)
    {
      $pdf-&gt;writeHTML('&lt;tr&gt;&lt;td&gt;Test1&lt;/td&gt;&lt;td&gt;Test2&lt;/td&gt;&lt;td&gt;Test3&lt;/td&gt;&lt;td&gt;test4&lt;/td&gt;&lt;/tr&gt;', '','');
    }
  
   $pdf-&gt;writeHTML('&lt;/table&gt;');
  </code></pre>
  
  <p>But I get errors, such as:</p>
  
  <pre><code> Notice: Undefined index: cols in
   Notice: Undefined variable: cellspacingx in 
  </code></pre>
  
  <p>Am I doing this correct as I can't find much information regarding outputting tables using a <code>foreach</code></p>
  
  <p>Thank</p>