How to insert a theme table form inside an existing form?
Here is sample example where form and tables are used together.

Step1: Gather whole data, going to use in table. 

$sample_data = array
(
  array('id' =&gt; 1, 'first_name' =&gt; 'jay', 'last_name' =&gt; 'chris'),
  array('id' =&gt; 2, 'first_name' =&gt; 'clo', 'last_name' =&gt; 'jason'),
  array('id' =&gt; 3, 'first_name' =&gt; 'len', 'last_name' =&gt; 'ken'),
);


Step2: Create table header.

$sample_header = array
(
  'first_name' =&gt; t('First Name'),
  'last_name' =&gt; t('Last Name'),
);


Step3: Create table rows and columns data.

$options = array();
foreach($sample_data as $data)
{
  $options[$data['id']] = array 
  (
    'first_name' =&gt; $data['first_name'], // 'first_name' was the key used in the header
    'last_name' =&gt; $data['last_name'], // 'last_Name' was the key used in the header
  );
}


Your data should be something like this:

Array
(
  [1] =&gt; Array
  (
    [first_name] =&gt; jay
    [last_name] =&gt; chris
  )

  [2] =&gt; Array
  (
    [first_name] =&gt; clo
    [last_name] =&gt; jason
  )

  [3] =&gt; Array
  (
    [first_name] =&gt; len
    [last_name] =&gt; ken
  )
)


Step4: Use drupal function(tableselect) for table

$form['table'] = array
(
  '#type' =&gt; 'tableselect',
  '#header' =&gt; $header,
  '#options' =&gt; $options,
);


Here is complete form for you.

function my_form($form, $form_state)
{
  $sample_data = array
  (
      array('id' =&gt; 1, 'first_name' =&gt; 'jay', 'last_name' =&gt; 'chris'),
      array('id' =&gt; 2, 'first_name' =&gt; 'clo', 'last_name' =&gt; 'jason'),
      array('id' =&gt; 3, 'first_name' =&gt; 'len', 'last_name' =&gt; 'ken'),
  );

  $sample_header = array
  (
    'first_name' =&gt; t('First Name'),
    'last_name' =&gt; t('Last Name'),
  );
  $options = array();
foreach($sample_data as $data)
{
  $options[$data['id']] = array 
  (
    'first_name' =&gt; $data['first_name'], // 'first_name' was the key used in the header
    'last_name' =&gt; $data['last_name'], // 'last_Name' was the key used in the header
  );
}

  $form['table'] = array
  (
    '#type' =&gt; 'tableselect',
    '#header' =&gt; $header,
    '#options' =&gt; $options,
  );

  $form['submit'] = array
  (
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),
  );
  return $form;
}


There can be some TYPO mistake, so do change in code accordingly.