Welcome Guest, Not a member yet? Register   Sign In
loop in form validation
#1

(This post was last modified: 03-15-2022, 03:04 AM by zaakee2022.)

I'm adding a record to the database for each line entered in the textarea part. I need to uniquely check these added records, but form confirmation did not work for me. Since there's a lot of data, I want to handle it without tiring the system.

my law is subjoining to data in every way. It works when I try it as input, but it does not work when I circle it.
What's the stylish way to check for uniques when there's too important data in mysql table?
Code:
$this->load->library('form_validation');
      $mails = $this->security->xss_clean($this->input->post('mail'));
      $data['mails'] = explode("\n", str_replace("\r", "", $mails));
      $data['vmails'] = array_filter($data['mails'], function ($s) { return filter_var($s, FILTER_VALIDATE_EMAIL); });

      foreach($data['vmails'] as $key=>$value){

        $this->form_validation->set_rules($value, 'Email Address', 'valid_email|is_unique[mail_list.mail]');
        if($this->form_validation->run())
        {
          $data_add = array('mail' => $value);
          $result = $this->mailist_model->addMailSingle($data_add);
        }

      }
Reply


Messages In This Thread
loop in form validation - by zaakee2022 - 03-13-2022, 10:20 AM
RE: loop in form validation - by shakirahrp - 03-17-2022, 04:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB