Why does my contact form download its PHP script on submission?

Rob June 7, 2011
Pinterest Stumbleupon Whatsapp

My contact form definitely used to work, so I’m not sure if this is due to a recent change of server. However, submitting the contact form now causes the PHP script file to download.

There’s no doubt a very easy solution, but it’s nigh on impossible to Google for information for obvious reasons given the keywords of the problem.

Any help appreciated!

The code of the form is posted below and the respective page can be found here.

<form method=”post” action=”contact.php”>
<p>&nbsp;</p>
<p><input name=”name” type=”text” id=”name” onfocus=”if(this.value==’Your Name’) this.value=”” value=”Your Name” /></p>
<p>&nbsp;</p>
<p><input name=”EmailFrom” type=”text” id=”EmailFrom” onfocus=”if(this.value==’Your Email’) this.value=”” value=”Your Email” /></p>
<p>&nbsp;</p>
<p><textarea name=”message” cols=”” rows=”” id=”msg” onfocus=”if(this.value==’Message’) this.value=””>Message</textarea></p>
<p>&nbsp;</p>
<p><input name=”submit” src=”graphic/send.gif” alt=”” title=”submit” type=”image”/></p>
</form>
Ads by Google

  1. Rob
    June 8, 2011 at 10:46 am

    Solved. Htaccess specifying the wrong version of php following the server swap. Thanks for your help.

    • Tina
      June 13, 2011 at 6:18 pm

      Thanks for your feedback!

  2. FIDELIS
    June 8, 2011 at 9:13 am

    Hello, just so you know, once you are done using the phpinfo script make sure to delete it.  It is not safe to keep this script on your space because practically anybody can access it by typing your path into a browser. 

  3. Jeffery Fabish
    June 7, 2011 at 4:04 pm

    This happened on my web server when PHP got corrupted. Is PHP currently installed and enabled? I can help you diagnose PHP availability if you tell me your web server's operating system and PHP version, if you don't host it yourself, who does?

    Try this:
    http://docs.simplemachines.org/index.php?topic=479.0

    Go to the page and it will give you the code for PHPinfo page. Save it as PHPInfo.php and upload it. Then navigate to that file. If PHP is running and active you should get a page popping up listing details about your PHP version, if you get an error or the page doesn't load, PHP is probably corrupt or not installed, in which case reinstall or enable.

    • Rob
      June 7, 2011 at 9:19 pm

      Hi Jeffery

      It's hosted on Media Temple (Plesk). I've no idea what PHP version it is or how to find out.

      I did the PHPinfo.php upload and when I navigated to that page it started to download the php file too.

      The line of enquiry you've sent me on has made me wonder whether a php "safe mode" could be the issue. Does that sound plausible?