我在使用选择列表的模块中制作了一个自定义表单,我试图用 OG 名称的名称填充它。
我为 db_query() & 编写了一个函数,它给了我准确的输出,但我无法从选择中填充它。
db_query() 的函数:-
function taskform_project_select(){
$options=array();
$project_query = "SELECT node.title FROM {node}, {og} WHERE node.nid = og.nid";
$project_details = db_query($project_query);
while($project_title = db_fetch_object($project_details)){
$options = $project_title->title;
dpm($options);
}
return $options;
}
表格中的代码:-
$options = taskform_project_select();
$form['edproject'] = array(
'#type' => 'select',
'#title' => t('Project'),
'#options' => $options,
'#description' => t('Choose a project'),
'#prefix' => '<td>',
'#suffix' => '</td>',
);
谢谢 :)