我试图让这段代码只显示有值的字段,任何没有值的字段都不打算显示。它似乎不起作用
知道我做错了什么吗?
我的简单测试表在这里http://www.healthybrighton.co.uk/wse/node/1844
/**
* Build a table of submitted values
*
* @param $form_vals array Submitted form data
* @param $select_mapping array Map select components to their value|label chocies
* @return HTML of the themed table
*/
function _format_form_state($form_vals = array(), $select_mapping) {
$output = '';
$header = array();
$rows = array();
if (!empty($form_vals)) {
foreach ($form_vals as $component_name => $component_value) {
$rows = array_merge(
$rows,
_add_component_row(
$component_name,
$component_value,
0,
$select_mapping
)
);
}
}
$output .= theme('table', $header, $rows);
return $output;
}