/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function mymodule_payment_tracker_form($foo_id) { $foos = foo_get_foos($foo_id); $bars = bar_get_bars($bar_id); // Create the table header. $form['header'][]['#value'] = t('Foos'); foreach ($bars as $bar_id => $bar_name) { $form['header'][]['#value'] = $bar_name; } // Create the rows. foreach ($foos as $foo_id => $foo_name) { $row['firstcol']['#value'] = $foo_name; foreach ($bars as $bar_id => $bar_name) { $row['payments']['#tree'] = TRUE; ); } $form['rows'][] = $row; } // Create a heading. $form['heading']['#value'] = '<h3>'. t('Payment tracker for foo.') .'</h3>'; '#type' => 'submit', '#value' => t('Save'), ); } else { $form['empty']['#value'] = '<p class="foo-empty">'. t('No foos found.') .'</p>'; } $form['#theme'] = 'mymodule_table_form'; return $form; }