Table in custom form + empty values in form_state
When you want to get the HTML of the table you must use the renderer service.

In Drupal 8:

$html = \Drupal::service('renderer')-&gt;render($form['table']);


Or better, use dependency injection :)

In Drupal 7:

$html = drupal_render($form['table']);