CodeIgniter Forums

Full Version: Multi form question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]tim1965[/eluser]
Hi i have a newbie question (which i know is very simple and maybe i having a stupido day, not again !!!)
So i have a multi form registration process, that will store the data for each form in a table as the form is submitted (temp tables until all data is captured), before caling the next form in the process.
I want to keep seperate controllers for each form (for validation and insert) if possible. My first form is correclty set up and i can validate and insert the data. So my stupido question is how do i call the next controller to process form 2 ?
I cannot use $this>load. Should i be calling an uri from my controller 1 to call my controller 2 ?
Many thnaks for your help.

El Forum

[eluser]GSV Sleeper Service[/eluser]
yeah, you can just redirect() from one controller to another.
I've recently done something similar, but my registration process steps were different methods in the same controller. (different controllers for each step seems overly complicated to me...) example below
Code:
class Registration extends MY_Controller {

    function index(){
        $this->stage1();
    }

    function stage1(){
        //display part 1 form

        //run validation
        //is it valid?
        redirect('registration/stage2');
    }

    function stage2(){
        //display part 2 form
        //run validation
        //is it valid?
        redirect('registration/stage3')
    }

    ...
}

El Forum

[eluser]tim1965[/eluser]
Excellent thanks for the response