I want to use some php to make simple header/footer files for my webpages. I’m just getting started in web design and I am using Coffee Cup HTML Editor.
Problem is I have this line in my index.php file:
?php include(“includes/header.html”);?>
and nothing shows up even though my header.html file has a menu in it.
Do I need to install something on my machine before PHP code will show anything?
Syntax errors
Firstly, your code snippet contains a syntax error. The opening PHP tag should be
<?phpand not?php. So your code should look like this:Install PHP
Secondly, you need to run PHP scripts on a PHP server like XAMPP for the code to actually be executed.
This assumes header.html either contains text or if it is PHP it
echo()s its output.