[eluser]Gavin Blair[/eluser]
Quote:Say I have the following:
1) An page that lists all the rows in a table. It has an ‘insert’ button that takes you to…
2) A form page that lets you enter a new value in the table.
I would like the ‘success’ page of (2) to take the user back to (1). So once the validation is complete and the row is inserted, I want to re-direct the control flow to a different controller function (the two controller functions may be in different controller files).
Any tips?
Thanks.
If I understand your problem correctly, I think you want
(2) to pass a message to
(1).
I would put something like the following in the view of
(1):
Code:
<?=isset($message) ? '<div id="alert">' . $message . '</div>' : ''?>
And then I would have the controller function of
(1) look like this:
Code:
function displaystuff($message = '') {
//get ready to display the rows of the table
...
$data['message'] = $message;
...
$this->load->view(..., $data);
}
And the function of the form like this:
Code:
function process_data() {
//process the POST input
...
//send the success message
$this->displaystuff('The form was successfully processed');
}
I know this works when both functions are in the same controller. I am not sure it will work when they are separate controllers.
Hope this helps
Gav