I've had this problem on two separate occasions, and finally I've made a substantial effort to diagnose it, but to no avail.
What's happening is, I set a captcha code to a session variable like this:
...
$_SESSION['form_captcha_code'] = security_code();
...where security_code is a function that generates a random 5-character alphanumeric string. My problem is, when I go to access this variable on another page, specifically, the one that handles the form and verifies the CAPTCHA, the variable has an entirely different value than the one that I set it to.
I *think* this may have something to do with the fact that I set it to the return value of a function, rather than a value itself, so that might explain how the function is seemingly being called again at the very top of my handler page. However, I changed the way I set the variable to just calling "security_code();" and having the function itself set the session variable, and it still does the same thing.
I'm pulling out my hair over this. Does anyone have any ideas on why this would happen?