Difference between revisions of "Embed PHP into HTML"

From Conservapedia
Jump to navigation Jump to search
(enclose your PHP code in tags)
 
(to configure your Apache server)
Line 1: Line 1:
−
To embed PHP into HTML, simply enclose your PHP code in <nowiki><?PHP</nowiki> and <nowiki>?></nowiki> tags like  begin and end your PHP code like this:  
+
To '''embed PHP into HTML''', simply enclose your PHP code in <nowiki><?PHP</nowiki> and <nowiki>?></nowiki> tags like this:  
 
  <?PHP echo "Hello, world!"; ?>
 
  <?PHP echo "Hello, world!"; ?>
 +
You may have to configure your [[Apache server]] (or have your system administrator do it for you). Include this line in your server's [[httpd.conf]] file:
 +
 +
[[AddType]] application/x-httpd-php .html .htm

Revision as of 16:07, November 23, 2010

To embed PHP into HTML, simply enclose your PHP code in <?PHP and ?> tags like this:

<?PHP echo "Hello, world!"; ?>

You may have to configure your Apache server (or have your system administrator do it for you). Include this line in your server's httpd.conf file:

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