CodeIgniter Forums

Full Version: Post data in Model is empty
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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