Treehouse: Grow your CSS skills. Land your dream job.

How to put a .php script in .html file

  • # March 28, 2012 at 9:48 am

    How to put a .php script in .html file …?


    # March 28, 2012 at 10:05 am

    If the HTML file has the extension .PHP, then it’s still HTML but the server will recognize it as a PHP file, and execute all PHP code in it.

    # March 28, 2012 at 11:33 am

    First save the file as .php instead of .html

    Ensure that your php script that you past into your html, that has now been saved as .php is still wrapped in < ?php //php code here ?>

    To view the php file though, you will have to be on a server that runs php and apache, or you can run it locally by downloading mamp(mac) or wamp(windows).


    Tutorial about MAMP by chris:

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.