Welcome Guest, Not a member yet? Register   Sign In
Validating forms
#1

[eluser]_Smilie_[/eluser]
Hi,
So as to my understanding I was supposed to put this somewhere in my viewfile where I want the errors to show up, in case of failure:
Code:
<?php echo validation_errors(); ?>
Very sadly this generates an error (undefined function), so I guess I made a mistake. Can any one point me in the right direction?

My controller:
Code:
function register(){
  if(!empty($_POST)){
   //Load required lib's:
   $this->load->helper(array('form', 'url'));
   $this->load->library('form_validation');
  
   //Setting rules
   $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
   $this->form_validation->set_rules('password', 'Password', 'required|matches[password_confirm]');
   $this->form_validation->set_rules('password_confirm', 'Confirm password', 'required');
   $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
   $this->form_validation->set_message('checkIPban', 'Your IP has previously been banned and you may not regiser again.');
   $this->form_validation->set_rules('ip', 'Banned IP', 'checkIPban');
  
   //check rules
   if ($this->form_validation->run() == FALSE){
    $data['formResponse'] = "Form validation failed!";
   }
  
   // load fielddatas
   if($ipbwi->member->create($_POST['username'], $_POST['password'], $_POST['email'], true, $_POST['displayname'])){
    if($ipbwi->member->login($_POST['username'], $_POST['password'])){
     header('location: '.ipbwi_WEB_URL).die();
    }
   }
  
  }
  //Show files
  $this->load->view('themes/fusion/global/form_header');
  $this->load->view('themes/fusion/account_register');
}


Messages In This Thread
Validating forms - by El Forum - 04-25-2012, 11:04 AM
Validating forms - by El Forum - 04-25-2012, 11:49 AM
Validating forms - by El Forum - 04-25-2012, 12:12 PM
Validating forms - by El Forum - 04-25-2012, 12:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB