in html, when you use html code, you can just type it in and it appears and works fine.
When you are doing html code from a php script, you must use the 'echo' command. If you view a php script from the browser, you'll notice none of the php script is displayed. Only the code that you used in the echo commands appears.
You just have to do 'echo "<html><head><title>"etc for any html you want to do inside the php file.