PHP code in HTM not being executed?
Posted: Fri Oct 30, 2009 11:58 am
I'm a complete novice to PHP so please excuse what is probably a very simple question.
echo("Fred");
works correctly in a .PHP file but not in an HTM, e.g.
My name is <?php echo(" Fred "); ?> Bloggs
only displays My name is Bloggs.
According to http://php.about.com/od/advancedphp/p/html_php.htm it says I need to add
AddType application/x-httpd-php .html
Or
AddType application/x-httpd-php .htm
to my .htaccess file.
If I do that and then open the HTML page the browser (Opera) comes up with a pop-up to download the html file.
What should I be doing?
Bob
echo("Fred");
works correctly in a .PHP file but not in an HTM, e.g.
My name is <?php echo(" Fred "); ?> Bloggs
only displays My name is Bloggs.
According to http://php.about.com/od/advancedphp/p/html_php.htm it says I need to add
AddType application/x-httpd-php .html
Or
AddType application/x-httpd-php .htm
to my .htaccess file.
If I do that and then open the HTML page the browser (Opera) comes up with a pop-up to download the html file.
What should I be doing?
Bob