Welcome Guest, Not a member yet? Register   Sign In
Need help with redirection after login
#1

[eluser]condoace[/eluser]
I have some files which require logging in/sessions. I am trying to redirect a user to the original page they went to before they were directed to login page - but my problem is that instead of redirecting to the view file it redirects to the form action - i.e. the controller method..

My code is:

Controller method called from form action:


Code:
function validate()
        {
        
            $this->load->library('session');
            
            $this->load->model('membership_model');
            
            $email = $this->input->post('email');
            
            $password = $this->input->post('password');
            
            $return = $this->membership_model->check_user($email,$password);
            
            if($return)
            {
            
                $data = array(
                
                    'email' => $email,
                    'password' => $password,
                    'logged_in' => TRUE
                    );
                
                $this->session->set_userdata($data);
                                                
                $template = array('main_content' => uri_string());
                                                
                $this->load->view('include/template',$template);
            }
            else
            {
            
                $this->index();
            
            }
        }

My form

Code:
<div class="signup"/>

    &lt;?php echo form_open('login/validate');?&gt;
    <fieldset>
    <legend class="signup_leg">Email</legend>
    <div class="signup_field">&lt;input type="text" name="email" id="email" class="signup_field" value="&lt;?php echo set_value('email')?&gt;"/&gt;
    </div>
    </fieldset>
    <fieldset>
    <legend class="signup_leg">Password</legend>
    <div class="signup_field">&lt;input type="password" name="password" id="password" class="signup_field" value="&lt;?php echo set_value('password');?&gt;"/&gt;
    </div>
    </fieldset>
    <fieldset>
    <div class="signup_field">&lt;input type="submit" name="submit" id="submit" class="signup_field"/&gt;
    </div>
    </fieldset>
    &lt;?php echo form_close();?&gt;
</div>




Theme © iAndrew 2016 - Forum software by © MyBB