CodeIgniter Forums
Post data in Model is empty - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Post data in Model is empty (/thread-48188.html)



Post data in Model is empty - El Forum - 01-07-2012

[eluser]Unknown[/eluser]
I have a problem.

Controller
Code:
$this->load->model('TestModel');
$name = $this->input->post('name');
$data['name'] = $name;
$date['status'] ="1";
$this->TestModel->create($data);

Model
Code:
echo $data['name'];                      //OUTPUT:""
echo $date['status'];                    //OUTPUT:"1"
$this->db->insert('test_table', $data);  //SUCCESS:inserts into database

I don't understand why it inserts the proper name into the database, but the value is empty when i try to perform operations on it.

Thanks