Welcome Guest, Not a member yet? Register   Sign In
[solved]index page loading after calling controller method, help needed
#1

[eluser]johansonevR[/eluser]
i've walked through the configuration files and now i can't remember what i did wrong :-S
i have a controller which as you can see calls the login_view page.
Code:
Class Login extends Controller{
    function Login(){
        parent::Controller();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->model('login_model');
        $this->load->library('session');
        }
    function index(){
    //$this->session->set_userdata('name','test');
        $rules=array(
                    array(  'field'=>'username',
                            'label'=>'username',
                            'rules'=>'required|alpha_numeric|min_length[3]|xss_clean'
                        ),
                    array(    'field'=>'password',
                            'label'=>'password',
                            'rules'=>'required|alpha_numeric|min_length[6]|xss_clean'
                        )
                );
        
        $this->form_validation->set_rules($rules);
        if($this->form_validation->run()==TRUE){
        $data=array('username'=>$this->input->post('username'),
                    'password'=>$this->input->post('password')
                    );
            $message['output']=$this->login_model->checkLogin($data);
            $this->load->view('login_success',$message);
            //test

        }else{
            $this->load->view('login_view');
            }
    }
}
the page exists it worked about 2 hours ago.
the controller calls the index page again after submiting the form.
Code:
http://localhost/project/index.php/index.php/login
and the result is as you might've expected a 404 error.
can you help up a bit to fix this ?
#2

[eluser]Sbioko[/eluser]
I know the solution and I'll help you if you'll show this form(view).
#3

[eluser]johansonevR[/eluser]
hmm, i forgot to mention i have other forms on different pages , and they act the same way. I think it is from the configuration or something of 3rd kind
Code:
<?php echo form_open('login','name=login');?>
<table>
<tr><td>&lt;?php echo form_input($input['username']);?&gt;</td></tr>
<tr><td>&lt;?php echo form_input($input['password']);?&gt;</td></tr>
<tr><td>&lt;?php echo form_submit($input['submit']);?&gt;</td></tr>
</table>
&lt;?php echo validation_errors();?&gt;
As i said it worked about 3 hours ago.
#4

[eluser]Sbioko[/eluser]
Yeah, check your config.php file. If you use URL rewriting, make index_page empty.
#5

[eluser]johansonevR[/eluser]
nice, it works now. Tnx for the help.




Theme © iAndrew 2016 - Forum software by © MyBB