codeigniter accesing object value in input element value getting Error

时间:2017-06-15 09:54:00

标签: codeigniter

enter image description here

In codeigniter: I found the data in object form in this page but when i assign value to particular input element it returning me the error. give me the solution

Output screen is given below: enter image description here

2 个答案:

答案 0 :(得分:1)

While fetching data from database please use

$query = $this->db->get();
$ret = $query->row();

In your code you are getting array, that's the reason you are getting error.

Let me know if you have another error.

Please change your line like given below.

<?php
echo form_input(array('id' => 'name', 'name' => 'name','value'=>$value->name)); 
?>

答案 1 :(得分:0)

请找到您的更新代码。

public function update($id) {
    $this->load->model('latest_model');

    $upd_data['name'] = $this->input->post('name');
    $this->db->where('id', $id);
    $val = $this->db->update('table_name', $upd_data);

    $data['value'] = $val;
    $this->load->view('new_login', $data);
}

重定向到另一个页面

$this->load->helper('url');
redirect('controllerName/methodName');

示例

redirect('user/dashboard');

如果不起作用,请告诉我。

相关问题