I try to use a combination of your two examples. I'm pretty sure things like trim won't change the actual data, so you can only use them if you go through a validation system to get the data. In fact, I never use POST again using CI.
, POST . , - " " , db ? , , . , .
.
:
$fields['email'] = "trim|required|valid_email|min_length[4]|xss_clean";
...
...
$this->validation->set_rules($fields);
if ($this->validation->run())
{
$account = new array();
$account['id'] = $accountId;
$account['email'] = $this->validation->email;
$this->account_model->save($account);
$this->session->set_flashdata('message', 'Done!');
redirect('account/settings');
} else {
...
}