Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter - showing original URL of index function?
    primarykey
    data
    text
    <p>I'm not sure if I'm approaching this fundamentally wrong or if I'm just missing something.</p> <p>I have a controller and within it an index function that is, obviously, the default loaded when that controller is called:</p> <pre><code>function index($showMessage = false) { $currentEmployee = $this-&gt;getCurrentEmployee(); $data['currentEmp'] = $currentEmployee; $data['callList'] = $currentEmployee-&gt;getDirectReports(); $data['showMessage'] = $showMessage; $this-&gt;load-&gt;view('main', $data); } </code></pre> <p>I have another function within that controller that does a bulk update. After the updates are complete, I want the original page to show again with the message showing, so I tried this:</p> <pre><code>/** * Will save all employee information and return to the call sheet page */ function bulkSave() { //update each employee for ($x = 0; $x &lt; 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-&gt;index($success); } </code></pre> <p>What is happening is that the original page is accessed using: localhost/myApp/myController</p> <p>after the bulk update it is showing as: localhost/myApp/myController/bulkSave</p> <p>when I really want it to show the url as the index page again, meaning that the user never really sees the /bulkSave portion of the URL. This would also mean that if the user were to refresh the page it would call the index() function in the controller and not the bulkSave() function.</p> <p>Thanks in advance.</p> <p>Is this possible?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload