Welcome Guest, Not a member yet? Register   Sign In
Fetch and Update Data in same page CodeIgniter
#3

(This post was last modified: 12-15-2017, 07:29 AM by ciadmin.)

(12-14-2017, 02:27 AM)kirasiris Wrote: I got stuck in a a problem in which I need to update some info from database in the same page that is shown.

On this case I'm fetching some "global settings" from a website in an index page which comes with a form in it. Here is a picture of it just to make it more clear to understand what I mean.

...

Thanks for helping.
Also any idea how can I use this globally in a template?

You can add an if statement to your controller (inside the "get_website_data" function) and you can check submit of any form field. Then you can put whole save data code inside of this if statement. I prefer to use form submit button for this. Because if you can check an input field and its value is empty, maybe you can't catch it in the controller. Like this:

Code:
if($this->input->post('submit_settings')){
// Saving data code
}

I hope this helps.
Reply


Messages In This Thread
RE: Fetch and Update Data in same page CodeIgniter - by nickimnick - 12-15-2017, 03:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB