0
我想呈現一個表格佈局(html表格),使第一個單元格包含一個複選框。表格式佈局的Drupal表格
$form = array();
$res = query('SELECT * FROM {mytable}');
$rows = array();
while($row = db_fetch_array($res)){
$record = array();
$checkbox = array(
'#type' => 'checkbox',
'#attributes' => array(
'value' => $row['id'],
'name' => 'myrecord[]',
),
);
$record[] = drupal_render($checkbox);
$record[] = $row['other_field_1'];
$record[] = $row['other_field_2']
$rows[] = $record;
}
$form['records'] = array(
'#value' => theme('table', array(), $rows);
);
return $form;
但所呈現的所有複選框具有輸出
<input type="checkbox" class="form-checkbox" name="" value="1" id="">
<input type="checkbox" class="form-checkbox" name="" value="1" id="">
<input type="checkbox" class="form-checkbox" name="" value="1" id="">
<input type="checkbox" class="form-checkbox" name="" value="1" id="">
那是什麼名稱和值的屬性沒有得到複選框上應用的問題?