大家好,我是 Codeigniter 的新手,我正在尝试获取与从前一页传递的 account_id 相关的所有数据。
我传递了 account_id,但没有传递与 account_id 关联的名称字段。名称字段为空白。
我收到一个错误:
这是我的控制器代码:
function input($account_id = '', $name = ''){
if((int)$account_id > 0){
$query = $this->db->select('name', $name);
$query = $this->db->get_where('db_accounts', array('account_id' => $account_id));
$data['account'] = $query;
$data['fname']['value'] = $name;
$data['faccount_id']['value'] = $account_id;
$data['name'] = '';
$data['account_id'] = '';
}
$this->load->view('manage/input',$data);
}
这是我的输入视图表单:
<?php
$data = array(
'name' => $fname['value'],
'account_id' => $faccount_id['value']
);
echo '<form action="/manage/edit" method="post" accept-charset="utf-8">';
echo form_hidden($data);
echo $account_id .' Account ID'.
form_input($faccount_id);
echo $name .' Name'.
form_input($fname);
$data = array('name' => 'submit', 'value' => 'Update Account', 'class' => 'submit');
echo form_submit($data);
?>
<?php echo form_close(); ?>