Welcome Guest, Not a member yet? Register   Sign In
auto fill a field from input box

not without seeing the code where you are performing your validation.

Of course sorry i forgot about that lol

function send()
  // Set Validation Rules
  $this->form_validation->set_rules('name', 'Name', 'trim|required|min_length[3]');
  $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
  $this->form_validation->set_rules('phone', 'Phone', 'trim|required|max_length[12]');
  $this->form_validation->set_rules('message', 'Message', 'trim|required|min_length[2]');

   // You can set additional rules here, but keep CAPTCHA test
  $rules = array(                    
                  "field" => "recaptcha_challenge_field",
                  "label" => "reCAPTCHA",
                  "rules" => "required|recaptcha_matches"

  // Validation runs false rteun back to form and show errors
  if ($this->form_validation->run() == FALSE) {
   $data['title'] = 'Contact us ';
   $data['description'] = '';
   $data['keywords'] = '';
   $data['main_content'] = 'contact';
   $data['error'] = $this->session->set_flashdata('error', 'Sorry there where some errors');
         $this->load->view('template', $data);
  // If everything is filled out with no errors procced with sending the form to email and database
  else {
  $name = $this->input->post('name');  
  $email = $this->input->post('email');
  $message = "Hey guys, someone has requested left a message" . "\n\r\n";
  $message .= "Name:". $this->input->post('name') . "\n";
  $message .= "Email:". $this->input->post('email') . "\n";
  $message .= "Phone:". $this->input->post('phone') . "\n";
  $message .= "Message:". $this->input->post('message');

  $this->email->from($email, $name);
  $this->email->to('[email protected]');
  $this->email->send(); // Send the message function to the persons email address
  $this->email->clear(); // Clears the form ready for another submission

  $data['title'] = 'Thank you, Message received.';
  $data['description'] = '';
  $data['keywords'] = '';
  $data['main_content'] = 'thanks';
        $this->load->view('template', $data);


I'd start with some basic troubleshooting. Like, commenting out your validation rules except the first one and running the form. If it passes, uncomment the next rule and repeat until you get the error. I'm betting it's your captcha rules. I don't see where you load the captcha helper and there is no recaptcha_matches validation rule that I am aware of. Although, I haven't used CI's captcha in a long time...

Yes i'll try that Chronix, and i seem to think its the captcha validation too,

If i comment out all the validation it works, soon as I put validation rules back in it show the error.

All helpers and lib files are autoloaded in the autoload.php config file btw

So if you only have 1 validation rule, like the "name" rule, it still fails?

Yes buddy, and not sure why!!! Sad

Sorry, If you commented out everywhere a rule is set except the first one and still get the error I'm not sure either (unless this is from within a library and not a controller). If you use a stepping debugger you could probably quickly find out though.

yes ill find it don't worry thanks again chronix legend

Theme © iAndrew 2016 - Forum software by © MyBB