How to create the same Header and Footer on Separate web pages in PHP

How to create the same Header and Footer on Separate web pages in PHP

In this tutorial, you will learn how to create a header and footer in PHP.

In each page, we have to write the same code for our header and footer, so in this tutorial, you will learn how to make global header and footer files.

  • First, create a file named Index.php.
  • Then create a file named header.php and footer.php.
  • You have to include header and footer in the index file.

Code of index.php

Code of header.php

Code of footer.php

Output

headerfooterphp