How to render a form in table layout
A little bit tricky

function your_form(){
  $form = array();
  ...
  $record_ids = array();

  foreach($record_set as $record){
      $record_ids[$record['id']] = ''; // Collect ids of your record as index
      $form['column1'][$record['id']] = array('#value' =&gt; $record['field1']);
      $form['column2'][$record['id']] = array('#value' =&gt; $record['field2']);
      $form['column3'][$record['id']] = array('#value' =&gt; $record['field3']);
  }

  $form['select'] = array(
      '#type' =&gt; 'checkboxes',
      '#options' =&gt; $item_ids,
  );

  $form['#theme'] = 'render_your_form'; // Theme registry function to render this form
}


Define theme_registry

function your_module_theme(){
   ...
   $theme['render_your_form'] = array(
       'arguments' =&gt; array('form' =&gt; array()),
   );
   return $theme;
}


Now write your theme handler

function theme_render_your_form($form=array()){
   $head = array('Select', 'Title Col 1', 'Title Col 2','Title Col 3');
   $rows = array();
   foreach(element_children($form['select']) as $id){
       $fields = array();
       $fields[] = drupal_render($form['select'][$id]); //This will render a checkbox, omit if not required
       $fields[] = drupal_render($form['column1'][$id]);
       $fields[] = drupal_render($form['column2'][$id]);
       $fields[] = drupal_render($form['column3'][$id]);
       $rows[] = $fields;
   }
   $output = theme('table', $head, $rows); // Theme as table output
   $output .= drupal_render($form); // Render rest of form components. (For D6)
   $output .= drupal_render_children($form); // Render rest of form components (For D7)
   return $output;
}