I am new to php. I just installed xampp and php code embedded within html does not work for me. The following is the code for header.php
<?php
echo "hi"; /* this works */
?>
<header>
<h1 class="brand"><a href="index.html"><img src="img/logo.png" alt=""><span>InvestFirst</span></a></h1>
<ul class="nav sf-menu clearfix">
<li class="active"><a href="index.html">Home<span></span></a></li>
<li><a href="index-1.html">About Us<span></span></a></li>
<li><a href="contact.php">Contact Us<span></span></a></li>
<?php
echo "hello"; /* This does not work */
?>
</ul>
</header>
I guess I missed out some configuration in xampp. Have added this line at C:\xampp\apache\conf\httpd.conf and at c:\xampp\apache\conf\httpd.conf as well. But this doesnt help
AddType application/x-httpd-php .html .htm
Not sure what the issue was. But I uninstalled xampp & installed it again. It is working fine now.
Save your code as an *.php file. HTML does not execute PHP code since it only describes the visualisation of a page on the client side. PHP is executed on the server therefore, a different file type is required.