CodeIgniter - showing original URL of index function? -


i'm not sure if i'm approaching fundamentally wrong or if i'm missing something.

i have controller , within index function is, obviously, default loaded when controller called:

function index($showmessage = false) {     $currentemployee = $this->getcurrentemployee();     $data['currentemp'] = $currentemployee;      $data['calllist'] = $currentemployee->getdirectreports();     $data['showmessage'] = $showmessage;     $this->load->view('main', $data); } 

i have function within controller bulk update. after updates complete, want original page show again message showing, tried this:

/** * save employee information , return call sheet page */ function bulksave() {     //update each employee     ($x = 0; $x < sizeof($_post['id']); $x++) {         $success = employee::updateemployeemanualdata($_post['id'][$x], $_post['ext'][$x], $_post['pager'][$x], $_post['cell'][$x], $_post['other'][$x], $_post['notes'][$x]);     }      $this->index($success);                 } 

what happening original page accessed using: localhost/myapp/mycontroller

after bulk update showing as: localhost/myapp/mycontroller/bulksave

when want show url index page again, meaning user never sees /bulksave portion of url. mean if user refresh page call index() function in controller , not bulksave() function.

thanks in advance.

is possible?

you calling index() funciton directly, within bulkupdate() hence uri not change index because not making new server request, navigating within controller class.

i use same controller function tasks this, directing traffic based on whether or not $_post data has been passed or not this...

function index() {      if($_post) {          //process posted data         ($x = 0; $x < sizeof($_post['id']); $x++) {             $data['showmessage'] = employee::updateemployeemanualdata($_post['id'][$x], $_post['ext'][$x], $_post['pager'][$x], $_post['cell'][$x], $_post['other'][$x], $_post['notes'][$x]);         }                 }     else {          //show page         $data['showmessage'] = false;      }      //continue load page     $currentemployee = $this->getcurrentemployee();     $data['currentemp'] = $currentemployee;      $data['calllist'] = $currentemployee->getdirectreports();     $this->load->view('main', $data);  } 

then if form submitting, point form @ in view this...

<?= form_open($this->uri->uri_string()) ?> 

this points form @ index, , because posting form data via $_post process data.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -