Welcome Guest, Not a member yet? Register   Sign In
Form validation returning FALSE
#7

(10-15-2017, 01:06 PM)dwlamb Wrote: $this->CI->input->method() !== 'post' in set_rules() does make sense if you look at the full context of 'public function set_rules' in core/Form_validation.php @ line 167 
PHP Code:
    public function set_rules($field, $label = '', $rules = array(), $errors = array())
    {
        // No reason to set rules if we have no POST data
        // or a validation array has not been specified
        if ($this->CI->input->method() !== 'post' && empty($this->validation_data))
        {
            return $this;
        } 
... 

if $this->CI->input->method() == 'get' it does not equal post.  The other half is true as well so the result is to not set validation rules for CI thinks there is nothing in $_POST.

CI knows nothing about the contents of the $_POST array yet in the conditional above. It only looks to see if
  1. The server received a POST request and
  2. The user has not provided an array of data to be validated instead of $_POST

When I said "That does not make sense." it was in reference to the server method.  What does not make sense is that the $_POST superglobal is set, but the server method is GET. The $_POST superglobal should be empty if the method is GET. Yet, it was confirmed that $_POST['email'] is set and not empty.

Something else is at play here.
Reply


Messages In This Thread
Form validation returning FALSE - by dwlamb - 10-14-2017, 12:05 PM
RE: Form validation returning FALSE - by PaulD - 10-15-2017, 04:58 AM
RE: Form validation returning FALSE - by dwlamb - 10-15-2017, 10:23 AM
RE: Form validation returning FALSE - by dwlamb - 10-15-2017, 01:06 PM
RE: Form validation returning FALSE - by dave friend - 10-15-2017, 06:01 PM
RE: Form validation returning FALSE - by dwlamb - 10-15-2017, 06:45 PM
RE: Form validation returning FALSE - by gmgj - 04-17-2019, 11:38 AM
RE: Form validation returning FALSE - by gmgj - 04-30-2019, 03:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB