Add PHP to HTML page?

Da Man

New member
I have a very simple, plain, HTML website run through webs.com (all pages must end in .html). I want to add a PHP script to the page. Could someone show me what a very simple, entire page code would look like for adding php? Remember I have very limited coding skills so don't assume I know much of what your talking about. I just need to know how I can run PHP code on an html page.
My page looks like this so far:

<html>



</html>


I need everything in between.
If I were to put in:

<html>
<head></head>
<body class="page_bg">
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>
</html>


I would get:

Hello, today is .
 
Unfortunely you cannot run php from a file with a .html extension. You need to change the filename to .php than you can add php code to the page.

<?php
$html = 'Dynamic Html';
?>
<html>
<?=$html ?>
</html>

However you could modify your php.ini so that it parses files with a .html extension as php.
 
Back
Top