I wanted to run php code in html file so i added this code in htaccess file.
AddType application/x-httpd-php .html .htm
when i run below code with it. it works fine.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Use PHP in HTML files</TITLE>
</HEAD>
<BODY>
<h1>
<?php
echo "It works!";
?>
</h1>
</BODY>
</HTML>
But when i include any file from my web directory then it doesn't work. i have used below code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Use PHP in HTML files</TITLE>
</HEAD>
<BODY>
<h1>
<?php
include("file.php");
echo "It works!";
?>
</h1>
</BODY>
</HTML>
What i should do to run php code in html.If this is not possible then what is another way to execute php code in html file?