Welcome Guest, Not a member yet? Register   Sign In
Logic for multi-step form.. not working.
#2

[eluser]smilie[/eluser]
Well, you have a logic error in your code.
Your code:

Code:
if(!$this->session->userdata('form_stage'))
        {

            if ($this->form_validation->run('suggest_1') == FALSE)
            {


            }
            else
            {
                # Here you set form_stage to 'step_2'
                $this->session->set_userdata('form_stage', 'step_2');
                
            }
        }
        
        # And here, you are checking if form_stage is 'step_2' - Which it IS! So code moves from here further on, setting bellow session to complete :-)
        if($this->session->userdata('form_stage')=='step_2')
        {
            if ($this->form_validation->run('suggest_2') == FALSE)
            {
                
            }
            else
            {
                
                $this->session->set_userdata('form_stage', 'complete');
                
            }
        }
        
        if($this->session->userdata('form_stage')=='complete')
        {

        }

See my comments above.

What I have done in one of order pages I created is:

Code:
function linux($step='1',$pck_id='0')
    {
        if($step == '' || empty($step))
        {
           # No step defined show error
        }

        /*
         * Step 1
         */
        if($step == 1)
        {
            # Show step 1 page
        }
        if($step == 2)
        {
            # Show step 2 page
        }
        if($step == 3)
        {
            # Last step, finish page
        }
     }

$step is simply param in the url, i.e.
domain.com/linux/1
Link to next page is: domain.com/linux/2 etc.
Of course, I place also some session data in it to double check data...

Hope this helps.

Regards,
Smilie


Messages In This Thread
Logic for multi-step form.. not working. - by El Forum - 09-07-2010, 04:44 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 04:14 AM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 09:34 AM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 09:38 AM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 10:35 AM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 11:50 AM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 12:17 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 12:29 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 12:34 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 12:40 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 01:07 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 01:18 PM
Logic for multi-step form.. not working. - by El Forum - 09-08-2010, 01:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB