I had looking more carefull to the code. You are starting the php code with <?php is not wrong, but it can be not recognized by the server, this is a configurabile optinon in PHP, if you change the extension to php3 and dose not work try to change all <?php to <? .