insert php into html code example

Example 1: insert an html page into php

<?php
// do php stuff

include('fileOne.html');
include('fileTwo.html');

?>

Example 2: inline php in html

<body>
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>

Example 3: insert php code

<?php
$host = "localhost";
$username = "username";
$pass = "";
$db="furniture";


// Create connection
$conn=mysqli_connect($host,$username,$pass,$db);

if(!$conn){
  die("Data connection error");
}
?>

Tags:

Html Example