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="">
那是什么名称和值的属性没有得到复选框上应用的问题?