codeigniter:在数据库中插入数据

I am trying to insert posted data to database as below.

public function submit_signup(){
            if($this->input->post('submit')){
                $user_data['data']=array(
                    'username'   =>     $this->input->post('username'),
                    'email'      =>     $this->input->post('email'),
                    'password'   =>     $this->input->post('password'),
                    'mobile'     =>     $this->input->post('mobile') 
                );
            }
            $this->load->model('user_model');
            if($this->user_model->register_user($user_data)){
                echo 'data entered';
            }
            $this->load->view('templates/header');
            $this->load->view('test',$user_data);
            $this->load->view('templates/footer');
        }

My Model:

class user_model extends CI_Model {
    public function __construct() {
        parent::__construct();
    }

    public function register_user($data){
        if(!$this->db->insert('user',$data)) {
            echo 'Data not entered';
        }
        return true; 
    }
}

When I press form this is what I get

A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: mysql/mysql_driver.php

Need your help

Make your array as

 $user_data=array(
                    'username'   =>     $this->input->post('username'),
                    'email'      =>     $this->input->post('email'),
                    'password'   =>     $this->input->post('password'),
                    'mobile'     =>     $this->input->post('mobile') 
                );

Remove ['data'] part.Then use it into insert query

Check manuall

Why don't you pass your exact array $user_data['data'] into the model function

if($this->user_model->register_user($user_data['data']))
{
    echo 'data entered';
}