using update function to display data within form, want to use same function to update on form post |
[eluser]Brad K Morse[/eluser]
In the admin controller I have the update function Code: function update() { In the model Code: function getVolunteer() { URL is domain.com/index.php/admin/update/4 It takes segment(3) as the id = 4, to pull in the appropriate data into the form which is the view (update) and what I want to do, is use the same getVolunteer and update function (above) to update that record that id = 4, when the form posts to itself, the form code is below (update view) Code: <?php as you can tell, I am new to this, any help is appreciated. p.s. I have url and form helper autoloaded, so any revising to shorten my code is appreciated, I have a feeling it can be shorten when I refer to a segment. I edited the getVolunteer function to reflect what I am trying to do Code: function getVolunteer() { Error message: http://cl.ly/8aaab4472f746ac2c8a7
[eluser]Brad K Morse[/eluser]
I think I got it to work: added a model function, updateVolunteer Code: function updateVolunteer($id) { then referenced it in the controller update function on post Code: function update($id, $data) { should I test for other things in the $_POST conditional? to make sure segment(3) is not empty? Let me know.
[eluser]Dennis Rasmussen[/eluser]
Use this library: http://ellislab.com/codeigniter/user-gui...ation.html
[eluser]Brad K Morse[/eluser]
Suggesting I use that, to properly accomplish the if($_POST) for running the updateVolunteer() function? |
Welcome Guest, Not a member yet? Register Sign In |