Welcome Guest, Not a member yet? Register   Sign In
Form Validation with existing $_POST data
#3

[eluser]chuckl[/eluser]
I guess I wasn't sufficiently clear in my description of the problem. The problem is that the $_POST array has existing elements when the controller is invoked.

In CodeIgniter's system/libraries/Form_validation.php file, the function run() has a check at the very beginning that checks to see if there are any entries in the $_POST array and if it is empty (count = 0) then it returns false.
Code:
// No validation rules?  We're done...
if (count($this->_config_rules) == 0)
{
  return FALSE;
}
Every example/tutorial I have seen uses the code I posted previously as the way to determine if this is the first time the page has been loaded. Obviously, since the $_POST array is not empty at this point, the run() function does not return but processes the form before its time.

I thought about clearing the $_POST array but I'm not sure how to go about doing that nor am I sure what the ramifications might be in doing so.


Messages In This Thread
Form Validation with existing $_POST data - by El Forum - 06-25-2011, 10:00 AM
Form Validation with existing $_POST data - by El Forum - 06-25-2011, 04:36 PM
Form Validation with existing $_POST data - by El Forum - 06-26-2011, 10:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB