> But why? Why is PHP echoing out something it should > not be echoing? The validation doesn't fail so as such, > the text should never be sent to stdout (the browser). > Or am I misunderstanding something?
Ok, I figured out what my problem was and I'd very much appreciate if someone who was intimately knowledgable with the inner workings of PHP (Rasmus, Zeev..?) could let me know why it's doing this. One thing I didn't mention in my initial post (mainly because I didn't think it was relevant to my problem) was that I am using Sessions and my validation function uses the Session ID as part of it's validation. Now, in my validation function, it's declaring $PHPSESSID as global so it can use it's value. We have enable_trans_sid turned on and whatever other option (if there is one) so that if the session ID isn't passed via a GET, PHP pulls the ID from the cookie. And that's what happens on almost every page - the session ID is pulled from the cookie variable and it's working no problem. Ok, so the make up of the script that I'm having issues with looks like this: (pseudocode) ------------------------- validation function { global $PHPSESSID; validate using $PHPSESSID; } process and define output switch( $action ) { case "msword": word headers(); case "html": echo output; break; } ------------------------- Now, when $action is "html", everything works fine. In the validation function, $PHPSESSID is pulled from the cookie variable, is checked against and validation passes. However, when $action is "msword", in the validation function, $PHPSESSID isn't pulled from the cookie and as such, validation fails. The only difference between the two actions is the for "msword", I'm sending the appropriate headers so that the output is opened up in Word. Now my question, with $PHPSESSID coming from a cookie as input, why would the output ( header() functions ) dictate whether or not that input is read correctly. IOW, why is the session ID not read from the cookie space when I use the header functions to specify that the browser should open up Word? That part of the code (reading PHPSESSID from the cookie) is executed and processed long before I send the header() function calls. It makes no sense to me and it must have something to do with how PHP parses and executes the script. Any ideas as to what exactly is going on would be very much appreciated! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php