[eluser]lachavvy[/eluser]
Hi,
I'm a bit confused when to use the function $this->input->post. I am using this function as part of updating the database information, I've seen in various examples of people using it in the controller or the model, but which is the best practice?
It was my understanding that the model, should only be used for database-based code, whilst the controller is used to tie the model and the view together (well, probably a bit more than that).
Sample code, that I've used this on [controller]
Code:
function edit_player(){
$update_data = array(
'playerID' => $this->input->post('pID'),
'playerName' => $this->input->post('pName'),
'playerPhoto' => $this->input->post('pPhoto'));
print_r($update_data);
$result = $this->player_model->edit_player($update_data);
if($result == true){
$this->session->set_flashdata('message', '<p class="success">Player edited.</p>');
redirect('admin/player');
}
}