I have an HTML script ("index.html") which includes the follow PHP code:
< ?php
include ('footer.php');
?>
The PHP script ("footer.php") contains the following code:
<?php
echo "Hello world!";
?>
When I run :index.html: on the WampServer as a localhost, the PHP code from "index.html: is displayed. How do I display "Hello world!" from "footer.php"?
Thank you!
I supposed that you save php file that you want to include as footer.php in the same directory where index.php exists. Now where you want to include footer.php, include this code at the desired location.
<?php
include ('footer.php');
?>
I think that space between < and ? in index.php was creating problem.
Edit : Exactly space between < and ? in index.php is creating problem and printing php code.