I am relatively new in Stackoverflow and this situation happened a few times. I'm not sure how to handle them in order to keep the quality of the post (question & answer).
The original PHP error was
Cannot modify header information - headers already sent, which as far as I know only have one cause. HTTP headers are modified after content was already sent. And in my opinion, the best way to fix is to move the
header() call before output is actually sent. That was my original answer, and in my opinion the only valid answer. But the discussion started shifting in the comments, and I lost control of it. At the end my answer got down-voted and the post was abandoned.
Should I delete my answer, as it is clearly not valid for the question author? Should I edit my answer to reflect the conversation in the comments and offer another alternative that I don't feel is right? Or should I also abandon this post even if the question was perfectly valid and my answer was in my opinion perfectly valid too? Should I down-vote the question to release my frustration?