CodeIgniter does not register

0

I'm trying to insert some data into the bank but I can not. Some problem in the array that CodeIgniter returns.

The following is the Controller that the form calls:

    function cadastrar()
{
    $this->load->helper('array');

    $dados = array();
    $dados2 = array();

    $dados2 = $this->input->post(NULL, TRUE);

    $this->load->model('Entidade_model', '', TRUE);

    if($this->Entidade_model->cadastrar($dados2))
    {
            $dados['tp_msg'] = 'success';
            $dados['msg'] = '<strong>Warning!</strong> Entidade inserida com sucesso!';
    }
    else{
            $dados['tp_msg'] = 'danger';
            $dados['msg'] = '<strong>Warning!</strong> Erro ao inserir entidade.';
    }

    $this->load->view('alert', $dados);
}

The Model that the Controller sends the data follows:

    function cadastrar(array $data)
{
    return $this->db->insert('entidade', $data);
}

And he does not register.

    
asked by anonymous 02.10.2014 / 15:29

1 answer

1

Next, man. First, I'd advise you to read the CodeIgniter user guide, especially this part ! Second, when I created my registration I followed the rule in this guide, so I filled the array only in the model and using the associative array like this:

  

$ data = array (           'title' = > $ this- > input- > post ('title')       );

    
10.10.2014 / 19:39