Welcome Guest, Not a member yet? Register   Sign In
Submit form
#1

[eluser]szulcseban[/eluser]
i have a form on example form_open('menu_backend/submit_form'), and now in submit_form() i want to go to index() from controller menu_backend and send info "changes saved".
Sorry for my poor english.
#2

[eluser]dbashyal[/eluser]
Quote:i have a form on example form_open(’menu_backend/submit_form’), and now in submit_form() i want to go to index() from controller menu_backend and send info “changes saved”.
Sorry for my poor english.

does this work? give a try. NOT TESTED


Code:
function index($msg = '') {
     $data['msg'] = $msg;

    $this->load->view('view_file', $data);
}

function submit_form() {
  // do validations and testings...
  // if success
      $this->index('Changes saved');
  // if not
     $this->index('Some error');
}
#3

[eluser]Popcorn[/eluser]
I think you will want something like flashdata notifications.

http://michaelwales.com/projects/flashda...fications/
#4

[eluser]Chris Newton[/eluser]
Flashdata is a method of sending info from page to page upon redirect.
http://ellislab.com/codeigniter/user-gui...sions.html

Using CI's session library:

CodeIgniter supports "flashdata", or session data that will only be available for the next server request, and are then automatically cleared. These can be very useful, and are typically used for informational or status messages (for example: "record 2 deleted").

Note: Flash variables are prefaced with "flash_" so avoid this prefix in your own session names.

To add flashdata:

$this->session->set_flashdata('item', 'value');
You can also pass an array to set_flashdata(), in the same manner as set_userdata().

To read a flashdata variable:
$this->session->flashdata('item');




Theme © iAndrew 2016 - Forum software by © MyBB