I wonder if it's because you are missing a final call drupal_render($form) in your theme function? Also a suggestion for simplifying your code, when you build the form change the loop with invoices to while ($invoice = db_fetch_object($invoices)) { $fieldname = 'invoice-' . $invoice->invoice; $form['invoice'][$invoice->invoice] = array( '#type' => 'checkbox', '#title' => $invoice->invoice, '#default_value' => 0, '#cp_data' => array( 'invoice' => $invoice->invoice, 'total_due' => $invoice->total_due, 'date_due' => $invoice->date_due, 'status' => $invoice->status ) ); } $form['invoice']['#tree'] = TRUE; Then instead of looping through the whole form/form values you can loop through invoice and have the invoice for the key getting rid of the need for string manipulation. Some like foreach ($form['invoice] as $invoice => $element) { or foreach ($form_values['invoice] as $name => $value) { nevets