![]() |
Help Me Understand Passing Data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html) +--- Thread: Help Me Understand Passing Data (/thread-54614.html) |
Help Me Understand Passing Data - El Forum - 09-17-2012 [eluser]CIwannabe[/eluser] Dear CodeIgniter Community, I am very new to CodeIgniter but I am dedicated to working with it. I have read the entire User Guide and almost everything is clear. But the one area that leaves me a bit confused is performing database updates through a form. From what I understand, it works like this: 1. Data is pulled from the database via a model 2. The data is passed from the model to a controller, and then into a view, where it pre-populates form fields 3. Upon submission, the data moves from the view back through the controller, into the model 4. Once back in the model, ActiveRecord is used to actually change the database record I don't quite get how to pass data between the model, controller, and view for this particular action. Can anyone share a sample of a complete flow for this? Even seeing how a single field gets updated would help a lot! Note: I have read the tutorials on NetTuts and they are great, but in the CRUD video they skip over the update function! Help Me Understand Passing Data - El Forum - 09-18-2012 [eluser]CIwannabe[/eluser] Please? I will be truly grateful for the help! Help Me Understand Passing Data - El Forum - 09-18-2012 [eluser]xerobytez[/eluser] Take a look at this, this example if pretty rough and simple but it should give you the basic idea of how things work. Hope this helps. Controller : /application/controllers/account.php Code: class Account extends CI_Controller { Model : /application/models/account_model.php Code: class Account_Model extends CI_Model { View : /application/views/account.php Code: <form method="post"> Help Me Understand Passing Data - El Forum - 09-19-2012 [eluser]CIwannabe[/eluser] xerobytez, Thank you very much for jumping in to help! I really do appreciate it. I've looked at numerous help/tutorial sites. They often discuss CRUD operations. But every time they get to "update," they either skip the details or do some kind of shortened version. It leaves a newbie rather lost. I'll implement the code you suggested and maybe come back for more! In the meantime, it would be terrific to hear from anyone else with more to add! |