php - Codeigniter no data sent posted on form -
my login system stopped working, can't fix it, i've been looking , seems data doesn't posted can't find problem.
this view:
<?php if(! is_null($err)) echo "<div class=\"alert alert-danger\">".$err."</div>";?> <form class="form-signin" action="<?php echo site_url("user/validate"); ?>" method="post"> <h2 class="form-signin-heading">please sign in</h2> <label for="email" class="sr-only">email address</label> <input type="email" name="email" class="form-control" placeholder="email address" required autofocus> <br/> <label for="password" class="sr-only">password</label> <input type="password" name="password" class="form-control" placeholder="password" required> <br/> <button class="btn btn-lg btn-primary btn-block" name="submit" type="submit">sign in</button> </form> </div> this my validate function inside user controller:
public function validate() { $email = $this->input->post('email'); $password = $this->input->post('password'); // load model echo "$email , $password sent"; print_r($this->input->post()); exit(); $this->load->model('user_model'); // validate user's login details $result = $this->user_model->validate($email, $password); // verify result if($result == 0){ // if user did not validate, show them login page again $err = 'invalid email and/or password.'; $this->login($err); }else{ // if user did validate send him homepage after setting credentials $this->session->set_userdata($result); redirect(site_url("/index/index")); } } the echo , print_r show no data posted.
after research found out problem should .htaccess file, current .htaccess:
rewriteengine on rewriterule ^(application) - [f,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] but it's not working.
- you have
exit();in validate function comment try :
if(!empty( $err ))try :
base_url("index.php/user/validate");try : load model inside
public function __construct()not inside of
public function validate()
Comments
Post a Comment