Welcome Guest, Not a member yet? Register   Sign In
how can redirect with validate
#6

[eluser]Abel A.[/eluser]
If you're trying to call another controller, it means your code is not very organized. CI is pretty well structured. Try following this:

Code:
class Form extends CI_Controller {

public function __construct()
{
  parent::__construct();
  
}

public function index()
{
  
  $this->load->helper('form');
  $this->load->library('form_validation');
  
  $this->form_validation->set_rules('username', 'username', 'required|callback__checkform');
  $this->form_validation->set_rules('password', 'password', 'required');
  
  if ($this->form_validation->run() == TRUE)
  {
   //form is valid
  }
  
  //load view here
}

public function _checkform($password)
{
  if ()//username and password are good
  {
   return true;
  }
  else
  {
   return false;
  }
}
}


Messages In This Thread
how can redirect with validate - by El Forum - 05-30-2012, 11:46 PM
how can redirect with validate - by El Forum - 05-30-2012, 11:49 PM
how can redirect with validate - by El Forum - 05-30-2012, 11:54 PM
how can redirect with validate - by El Forum - 05-30-2012, 11:55 PM
how can redirect with validate - by El Forum - 05-31-2012, 12:05 AM
how can redirect with validate - by El Forum - 05-31-2012, 12:20 AM
how can redirect with validate - by El Forum - 05-31-2012, 12:26 AM
how can redirect with validate - by El Forum - 05-31-2012, 12:40 AM
how can redirect with validate - by El Forum - 05-31-2012, 12:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB