Jump to content

[SOLVED] Using PHP on a .htm or .html page


websmoken

Recommended Posts

Sorry to say it Mika, but if PHP is poorly configured <? ... your code ... ?> should work ;) You should favor <?php ?> tags over <? ?>

 

But other than that mika is completely right.

 

You simply put your php code inside an opening and a closing tag:

 

<html>
  <head>
    <title><?php echo $title; ?></title>
  </head>

  <body>
    <p><?php echo $something; ?></title>
  </body>

</html>

I would have to hate to differ on the above point it will not work until you have the following setting in apache

 

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

 

thats is the apache configration file... just by putting the <?php tag it won't work!!

Thanks Guys

 

I would have got back sooner but had to go out of town.

 

I know how to use PHP & HTML together, but always had to save as a FILENAME.PHP.  I will try your solutions.  I think that rajivgonsalves had what I had seen before.

 

Again Thanks for all the input.  I'll mark this as solved.

 

Dave

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.