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
#2

(This post was last modified: 03-21-2022, 09:41 PM by shakirahrp.)

Quote: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 formidasbuyrent a car dubaiblue world cityzameen 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?




Your form validation fails due to use of xss clean check in all the fields. If you remove that it validate your fields.As your data is already xss cleaned(assuming global_xss_filtering is TRUE in config)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB