![]() |
Getting value of ID from view to controller to model - 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: Getting value of ID from view to controller to model (/showthread.php?tid=30646) |
Getting value of ID from view to controller to model - El Forum - 05-21-2010 [eluser]Unknown[/eluser] Hello, I have a URL in a link on my view similar to the following: Code: <a href="example.com/class/gather/123"> I see how to access the ID segment in the controller: Code: function gather($id) But I'd like to something like the following in my model: Code: $this->load->database(); Access the record in the database corresponding to that ID value. Pass that back to the controller, then to the view. I get an error about undefined variable in the model. What do I have to do to pass the value of $id to the model from controller? I didn't see any examples of this. Thanks for the help in advance! Getting value of ID from view to controller to model - El Forum - 05-21-2010 [eluser]mattpointblank[/eluser] Controller: Code: function gather($id) Model: Code: function getPerson($id) Or similar. Getting value of ID from view to controller to model - El Forum - 05-21-2010 [eluser]Unknown[/eluser] OK! Got it to work. Many thanks. |