i need help. have edit form after edited records, redirect page , display automatically modal message passed set_flashdata.
this i've tried far:
view
<button type="button" class="btn btn-primary btn-success" data-toggle="modal" data-target="#modalsuccess"> modal success </button> <div class="modal fade modal-success" id="modalsuccess" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="mymodallabel">modal success</h4> </div> <div class="modal-body"> <?php echo $message;?> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <button type="button" class="btn btn-success">ok</button> </div> </div> </div> </div>
controller:
// check see if updating user if($this->ion_auth->update($user->id, $data)) { // redirect them admin page if admin, or base url if non admin $this->session->set_flashdata('message', $this->ion_auth->messages() ); if ($this->ion_auth->is_admin()) { redirect('auth/profile/', 'refresh'); } else { redirect('auth/profile/, 'refresh'); } }
i have no idea how fire modal automatically once receives message set_flashdata. ideas? gladly appreciate it. thanks!
codeigniter session set flash data works when have redirecting.
currently have set flash data out side of redirect
and because using refresh redirect it clear .
if($this->ion_auth->update($user->id, $data)) { // redirect them admin page if admin, or base url if non admin if ($this->ion_auth->is_admin()) { $this->session->set_flashdata('message', $this->ion_auth->messages()); redirect('auth/profile'); } else { $this->session->set_flashdata('message', $this->ion_auth->messages()); redirect('auth/profile'); } }
on view echo flashdata
<?php echo $this->session->flashdata('message');?>
Comments
Post a Comment