How to display an HTML table after the form submission on the same page as the form?
If you're saving your data in $_SESSION vars, I think the easiest way would be to check for the existence of your session data when you build up the form. Then you can show the table at the top of the form if the user has already submitted data, and the normal part of the input form directly underneath. A basic example:

function my_form($form, &amp;$form_state) {
  if (isset($_SESSION['my_var'])) {
    $form['table'] = array(
      '#markup' =&gt; 'Your table markup based on session data here'
    );
  }

  $form['input'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; 'Title'
  );

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

function my_form_submit($form, &amp;$form_state) {
  $_SESSION['my_var'][] = $form_state['values']['input'];

  $form_state['rebuild'] = TRUE;
}


You'll probably need to put some sort of mechanism to clear that session var at some point, if you want users to be able to reset their submission.

A more complete example with functionality to remove items:

function MYMODULE_form($form, &amp;$form_state) {
  // If we have some session data set, build a table
  if (isset($_SESSION['MYMODULE_data'])) {
    $header = array('Food', 'Calories');
    $options = array();
    $total = 0;
    foreach ($_SESSION['MYMODULE_data'] as $item) {
      $options[$item['identifier']] = array(
        $item['food'],
        $item['calories']
      );

      // Keep a running total
      $total += $item['calories'];
    }

    // Add the total row
    $options[] = array('Total calories', $total);

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

    $form['remove_item'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; 'Remove Selected',
      '#submit' =&gt; 'MYMODULE_form_remove_item'
    );
  }

  $form['food'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; 'Food'
  );

  $form['calories'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; 'Calories'
  );

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

  return $form;
}

function MYMODULE_form_remove_item($form, &amp;$form_state) {
  $remove = array_filter($form_state['values']['existing_data']);
  foreach ($remove as $key) {
    unset($_SESSION['MYMODULE_data'][$key]);
  }
  $form_state['rebuild'] = TRUE;
}

function my_form_submit($form, &amp;$form_state) {
  // this example will just use the food name as the identifier
  $_SESSION['MYMODULE_data'][] = array(
    'identifier' =&gt; $form_state['values']['food'],
    'food' =&gt; $form_state['values']['food'],
    'calories' =&gt; $form_state['values']['calories']
  );

  $form_state['rebuild'] = TRUE;
}


I haven't tested that but it should give you a good starting point even if there are a few bugs.