I have looked all over the internet for an answer but I can't find it so I will ask here. I have some forms in site and I am not sure how to pass the $_POST to the model I have thought of some options here they are:
Method 1:
Access the $_POST
directly from the model the problem I see with this approach is that now my model is tied down to my view which makes my model not reusable.
Method 2:
Create a $data
array which contains the post information but the again if I have 10+ fields in my form assigning all this variables is tedious to do and in the model I have to know what I named the key in the controller.
Method 3:
Passing each $_POST
key as a parameter to the model function, but this presents a similar problem to Method 2 that if I have 10+ fields in would be a lot of parameters and if I want to add a new parameter later it's a lot of code to rewrite.
I want like to know how other php programmers are doing this.