![]() |
Help with Update in CRUD. - 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: Help with Update in CRUD. (/showthread.php?tid=28099) |
Help with Update in CRUD. - El Forum - 03-01-2010 [eluser]HSKrustofsky[/eluser] Well, I've pretty much got everything working in my CRUD. The only thing is with the update function. I know in editnews.php I need to have a value within the form, but everything I try to input never seems to bring up anything. Any help would be awesome. Here is the code: admin_model.php Code: <?php admin.php Code: <?php editnews.php Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" Help with Update in CRUD. - El Forum - 03-02-2010 [eluser]xeroblast[/eluser] try this: Code: function update($data,$id) { Code: if($_POST) { Help with Update in CRUD. - El Forum - 03-02-2010 [eluser]HSKrustofsky[/eluser] Thanks for your help, but I did you what you said, and nothing. What could I have done wrong? Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]xeroblast[/eluser] try to change this: <?= form_open('../admin/update/') ?> to: <?= form_open('admin/update') ?> Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]HSKrustofsky[/eluser] When I first did the form I did that, and it didn't work. I had to add the ../ in order for the page to read the cotnroller. I was looking online and I think I have to set a value to the form, but can't seem to get anything to show up when I do. I also can't seem to get any information to change when I input new information in the fields. Do you think this may be the issue? Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]wakey[/eluser] <?= form_input('title') value ?> Should the value be there? Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]HSKrustofsky[/eluser] I had added a value, but when nothing work I started deleting them. I guess I didn't delete all of them. I'm pretty sure a value needs to be there. That's one of things I'm stuck on. All I need it to do is bring up that id's info so I can update whatever information comes up. Thanks in advance for everyone's help. Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]wakey[/eluser] If you need to retrieve data to be updated you will need to create a function to retrieve the data from the database and then echo this into the form in the editnews view - is this what you mean? Help with Update in CRUD. - El Forum - 03-03-2010 [eluser]HSKrustofsky[/eluser] Yes. That's exactly what I need to do. Help with Update in CRUD. - El Forum - 03-04-2010 [eluser]xeroblast[/eluser] i think this is the line where you got it wrong: your controller: Code: function update() { your view: Code: <li> you should do it like this: controller: Code: function update($id) { your view: Code: <?= form_open($this->uri->uri_string()) ?> your model should have this: to get a single row data... Code: function get($id) { |