Welcome Guest, Not a member yet? Register   Sign In
$_POST, put in controller or model?
#1

[eluser]jtan[/eluser]
What's the best practice, to have the $_POST in controller or model?
#2

[eluser]kanjimaster[/eluser]
Neither. Codeigniter makes that data available wherever you need it via the $this->input->post() method, so there's no need to ever access the $_POST variable anywhere.

Whether you access the data available in post() in your controller or model (or a library or a helper) would depend on what it is and what you're doing with it - there's no single right answer.
#3

[eluser]borgir[/eluser]
That depends on the context, although codeIgniter encourages the use of the controller to validate the post data, and the model to make use of the posted data.




Theme © iAndrew 2016 - Forum software by © MyBB