Can I use the PHP form in a HTML web site?

Posted by on Mar 24, 2011 in How To, Tips

Can I use the PHP form in a HTML web site?

The easiest way to use the PHP contact form is to make your page end with .php, like a page name contact.php (the recommended way)

Some people try to add the PHP code to a page that ends with .html, like a page name contact.html
Then the form does not show up because the web server does not know anything about PHP in a .html document type.

You can add the code to an .html page if you also set up your web server to parse PHP in .html files.
(not normally enabled by default)

If you are creating a new file anyway, you may as well use .php. This method to use PHP in .html files is to help people who have existing .html pages they need to execute PHP on.

See this article for more information and instructions on using PHP in .html files: Execute PHP from a .html File

Do you need help?

Send us a Donation:

Donate to Mike Challis