What application are you saving this from? Have you tried simply cutting and pasting your code into notepad and saving it as a .php file and test it from there? (not that I recommend using notepad to build php sites).
It sounds like whatever app you are using, something's not quite right to be sure.
Do a search on IDEs.. there are some threads kicking around on recommended apps for php coding.
Cheers,
NRG