Reza Fahmi Reza Fahmi - 5 months ago 8
HTML Question

display php result in html page

how to display php result in html file?
this is my index.html file

<html>
<head>
<title>My PHP Page</title>
</head>
<body>
This is HTML code
<?php
include("blabla.php");
?>
Back into HTML
</body>
</html>


and i want to display the blabla.php result in index.html
but the result when i execute the index.html is

This is normal HTML code Back into normal HTML


thanks before :)

Answer

You can't run PHP in .html files because the server does not recognize that as a valid PHP extension unless you tell it to. To do this you need to create a .htaccess file in your root web directory and add this line to it:

AddType application/x-httpd-php .htm .html

This will tell Apache to process files with a .htm or .html file extension as PHP files. for more info please read this http://php.about.com/od/advancedphp/p/html_php.htm