*sigh*...you are not a "coding moron" and I never said or tried to imply that.
Your PHP code, for example, would surely work. Just not the way you want it to.
All I was saying is that you need to try to find something (book, online, whatever) that will help you understand the role of the web server versus the role of the browser.
Anyway, see if you can't find something that discusses how PHP responds to HTTP requests and I will bet that all of a sudden you will have an epiphany.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.