I recommend that you use the properties offered by the framework
CONTROLLER
function post_agregar()
{
$nombre = $this->input->post('nombre');
$apellido = $this->input->post('apellido');
$usuario = $this->input->post('usuario');
$contrasena = $this->input->post('contrasena');
$email = $this->input->post('email');
$data = array
(
'nombre' => $nombre,
'apellido' => $apellido,
'usuario' => $usuario,
'contrasena' => $contrasena,
'email' => $email
);
$add = $this->tu_modelo->nombre_de_tu_funcion($data);
if ($add == true)
{
$this->session->set_flashdata('add','Se registro con exito!');
redirect('tu_controlador', 'refresh');
}else {
$this->session->set_flashdata('error','No se ha podido guardar');
redirect('tu_controlador', 'refresh');
}
}
MODEL
function nombre_de_tu_funcion($data = array())
{
$this->db->insert('tu_tabla', $data);
return $this->db->insert_id();
}
With this you enter your data without problems.
NOTE: In programming you can not use the "Ñ"
Greetings.