CodeIgniter Forums
Passing arguments from view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Passing arguments from view (/showthread.php?tid=24222)



Passing arguments from view - El Forum - 11-03-2009

[eluser]donaldpcook[/eluser]
Hi all,

I'm new to CI and MVC in general, and I have a simple question.

How would I pass an argument from the view to the controller (which I would then use in the model)? For example, I am trying to use a function in my model to query the database. I only want it to pull certain data (by using the argument in the WHERE of the active record in my model function) determined by what I request in my view, instead of running a foreach through all of the records in the database.

Is there a proper MVC way of doing this?

Thanks a lot!


Passing arguments from view - El Forum - 11-03-2009

[eluser]rogierb[/eluser]
You can pass the data through the url or post them in a form.

Either way will do.


Passing arguments from view - El Forum - 11-03-2009

[eluser]donaldpcook[/eluser]
Simple! Thanks for the quick reply Smile