Welcome Guest, Not a member yet? Register   Sign In
Calling function inside another function
#1

[eluser]Tanag[/eluser]
Basically I want to call my default function from another function in my controller.

Example:

Code:
class Store extends MY_Controller {

        function Store()
        {
            parent::MY_Controller();

            $this->load->helper('form');
        }

    function index()
    {
            // Junk happens here
        }

    function second()
    {
            // Want to call first function here
        }

I have a form in the default function, my second function processes that form, and then I want to return to the default with a message saying success or failure.
I figure this is the easiest way to do it, or would some kind of redirect while storing data in a session or post be better?
#2

[eluser]danmontgomery[/eluser]
You really shouldn't be expecting a return value from controller functions, but you can call

Code:
$this->index();




Theme © iAndrew 2016 - Forum software by © MyBB