How to display data in tables using Forms API? I want to organize my data in table rows. How can I user Forms API to do it?

EDIT:

I want to show the data in the following way in multiple rows:

row1 checkbox info1 textfield1 info2 textfield2 ....

....

rowN ....

row 1 [add a new row fields here]

...

row 5 

One should be able to cancel existing records and in the bottom fill in fields to add new records.

And I finding the solutions  in this link  or in this really difficult to understand.
The simplest way to do this (on small forms) that I have found is by taking advantage of the #prefix and #suffix elements in the render array. Here's an example:

$form['foo_fieldset'] = array(
  '#type' =&gt; 'fieldset',
  '#prefix' =&gt; '&lt;table&gt;',
  '#suffix' =&gt; '&lt;/table&gt;',
  '#tree' =&gt; TRUE,
);
$form['foo_fieldset']['header'] = array(
  '#markup' =&gt; '&lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;A checkbox&lt;/th&gt;
      &lt;th&gt;A text input&lt;/th&gt;
      &lt;th&gt;A text input&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;',
);

for ($i=0;$i&lt;10;$i++) {
  $form['foo_fieldset']['row_' . $i] = array(
    '#prefix' =&gt; '&lt;tr&gt;',
    '#suffix' =&gt; '&lt;/tr&gt;',
  );
  $form['foo_fieldset']['row_' . $i]['checkbox'] = array(
    '#type' =&gt; 'checkbox',
    '#prefix' =&gt; '&lt;td&gt;',
    '#suffix' =&gt; '&lt;/td&gt;',
  );
  $form['foo_fieldset']['row_' . $i]['text_1'] = array(
    '#type' =&gt; 'textfield',
    '#prefix' =&gt; '&lt;td&gt;',
    '#suffix' =&gt; '&lt;/td&gt;',
  );
  $form['foo_fieldset']['row_' . $i]['text_2'] = array(
    '#type' =&gt; 'textfield',
    '#prefix' =&gt; '&lt;td&gt;',
    '#suffix' =&gt; '&lt;/td&gt;',
  );
}


The other way to do it (maybe known as the "right" way) involves building a theming function to render your form in a table. Take a look at this page (ignoring the tablesort options as you don't care about that) to see how it's done: http://coffeeshopped.com/2010/09/drupal-drag-and-drop-tables-in-custom-modules