$form table displays no table data I just made a $form['table']. It shows enough rows (the count of the total rows in database) only it doesn't show the results. I tried using #value, #title, #markup but nothing works

Screenshot of result:



My code:

function push_notifications_stats_form($form, &amp;$form_state) {
$form = array();
$id = $_GET['id'];

$query = db_query('SELECT * FROM push_notifications_messages WHERE msg_appID = :app_id', array(':app_id' =&gt; $id));
$qCount = db_query('SELECT * FROM push_notifications_messages WHERE msg_appID = :app_id', array(':app_id' =&gt; $id))-&gt;rowCount();

$form['table'] = array(
    '#theme' =&gt; 'table',
    '#header' =&gt; array(t('Message'), t('Device'), t('Date')),
    '#rows' =&gt; array(),
    );

foreach($query as $result) {
  for($i = 1; $i &lt;= $qCount; $i++) {
    $form['table']["#rows"]["r$i"] = array(
        "'c1'" =&gt; array(
            '#type' =&gt; 'textfield',
            '#value' =&gt; t('hoi'),
          ),
        'c2' =&gt; array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('device')
          ),
        'c3' =&gt; array(
            '#type' =&gt; 'textfield',
            '#title' =&gt; t('device'),
          ),      
      );
  }
}


$form['id'] = array(
'#type' =&gt; 'item',
'#title' =&gt; 'Application ID',
'#description' =&gt; t('The application ID you are viewing: @appId', array('@appId' =&gt; $id)),
);  

return $form;

}


When I check the $form with dsm it does show the results.. And also when I use my browsers element inspector it does show the values. Only it puts them inside the first  tag. while it should be between the  tags

&lt;td #type="textfield" #value="hoi" #data="hoi"&gt;&lt;/td&gt;
I think you are mis-using #header and #rows properties of the Form API and getting them confused for variables passed to the theme_table function that is being called with the form['#theme'] =&gt; 'table'.

This question is similar and might be what you're looking for: How to insert a theme table form inside an existing form? 

Perhaps you want to use the tableselect element?