[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.