CodeIgniter Forums
Multi form question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Multi form question (/thread-13590.html)



Multi form question - El Forum - 11-28-2008

[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.


Multi form question - El Forum - 11-28-2008

[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')
    }

    ...
}



Multi form question - El Forum - 12-01-2008

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