[eluser]huangxiao[/eluser]
Hi already change it as your suggested but i have problem in the redirect(), it will duplicate the url when i submit the form.
something like this.
[qoute]http://localhost/test/index.php/login/localhost/test/index.php/success/members_area[/qoute]
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller{
function index(){
$data['maincontent'] = "login_view";
$this->load->view("include/template",$data);
}
function getlogin(){
$this->load->model('login_model');
$query = $this->login_model->login_check();
if($query){
$data = array(
'username'=>$this->input->post('username'),
'is_logged_in'=>true
);
$this->session->set_userdata($data);
redirect('/success/members_area');
}
}
}
This is my form
Code:
<div class='container'>
<form class="login" action="index.php/login/getlogin" method='post'>
<h2>Log-in</h2>
<input type='text' placeholder="username" name="username">
<input type='text' placeholder="password" name="password">
<button type="submit" >Log-in</button>
</form>
</div>