Filtering Database Results |
[eluser]mikeshima[/eluser]
Hi guys, I'm trying to create a filter screen to include a where statement depending on the users form input but I'm struggling to set an arrays value within the model - it sounds very trivial I feel stupid asking. Controller Code Code: public function filterLinks($param = 'form') Model Code Note: the value $filterArray is created in the class outwith the constructor Code: class Paypal_Model extends Model Code: public function filterPref(){ The problem I'm having is that once the user hits submit on the form it doesn't store the variable of that has been passed in, in the array filterArray. Yet strangely, the error messaging for when there is less than one result being displayed works fine. I'm having a very sore head from this code - any help would be appreciated. Thanks
[eluser]Georgi Budinov[/eluser]
In order to use post data from the model perhaps try using the $_POST array or get instance to the controller and use the input class as you use it now. But it is better practice to catch the array from the controller and pass it to the model.
[eluser]mikeshima[/eluser]
Hi Georgi, Thanks for the quick reply, how do I catch the array from the controller? I was under the impression you could only do it from the model.
[eluser]Georgi Budinov[/eluser]
Read this - http://ellislab.com/codeigniter/user-gui...input.html Currently you are catching the post variables the right way but from the model as I can see. Should be the controller.
[eluser]mikeshima[/eluser]
Thanks a lot Georgi, after some hacking I got it to work ![]() Thanks again. |
Welcome Guest, Not a member yet? Register Sign In |