Codeigniter passing 2 arguments to callback

后端 未结 6 848
不思量自难忘°
不思量自难忘° 2020-12-05 13:30

After posting a form having two fields named \'id\' and \'url\' I have the following code:

$this->load->library(\'form_validation\');
$this->form_va         


        
6条回答
  •  余生分开走
    2020-12-05 14:22

    It's better to use Form Validation library to get the data that is being validated.

    Not always your data will be in $_GET or $_POST (see https://www.codeigniter.com/userguide3/libraries/form_validation.html#validating-an-array-other-than-post).

    The best way you can access your data inside a validation callback is this:

    $this->form_validation->validation_data
    

    "validation_data" is a public property in the CI_Form_validation class.

提交回复
热议问题