Apeowl: So here you can see that I was able to write the contents of $_POST to a file, and read them back out, just fine.
Apeowl: Which means there's something somewhere in the code you aren't showing us, or maybe it's in the code you DID show us and we just can't tell because it's too hard to read, that is causing your problem.
Apeowl: My suggestion would be to start by writing your PHP so that you're not echo'ing HTML out of PHP.
that's not going to be a small rewrite, based on what you've shown
Most likely, in that process, you'll either realize what the error IS, or you'll fix it just by nature of making your code easier to read.