Include PHP file into HTML file

0 votes

I'm working on a project where the identical content on all HTML pages might need to be changed. As a result, I reasoned that I would build a PHP file and only have to update that to make changes on all web pages.

The files are saved under:

index.html
number.php

EXAMPLE:

------------------------(HTML FILE)----------------------------

<html>
   <head>
      <title>Home</title>
   </head>
   <body>
      <h1>Phone Number</h1>
      <?php include('number.php') ?>
   </body>
</html>

------------------------(PHP FILE)----------------------------

<?php
   echo 4895553268;
?>

What would I be able to achieve without converting all of my html files to php? I've discovered that it functions, but I would like to only alter the HTML code. I've tried script tags and can't seem to get it to operate properly after using include require tags first.

Jul 31, 2022 in PHP by Kithuzzz
• 38,000 points
695 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to prevent direct access to a php include file?

Hello @kartik, Add this to the page that ...READ MORE

answered Oct 1, 2020 in PHP by Niroj
• 82,840 points
3,524 views
0 votes
1 answer

How to prevent direct access to a php include file?

Hello @kartik, Add this to the page that ...READ MORE

answered Oct 19, 2020 in PHP by Niroj
• 82,840 points
1,784 views
0 votes
1 answer

How do I add PHP code/file to HTML(.html) files?

Hello @kartik, You can't run PHP in .html ...READ MORE

answered Oct 22, 2020 in PHP by Niroj
• 82,840 points
684 views
0 votes
1 answer

How can I include a php file and also send query parameters in php?

Hello, You could do something like this to ...READ MORE

answered Nov 10, 2020 in PHP by Niroj
• 82,840 points
6,254 views
0 votes
0 answers

How to write into a file in PHP?

I have this script on one free ...READ MORE

Jun 20, 2022 in PHP by Kithuzzz
• 38,000 points
480 views
0 votes
0 answers

Difference between require, include, require_once and include_once?

In PHP: When should I use require vs. include? When should I ...READ MORE

Jun 14, 2022 in PHP by narikkadan
• 63,600 points
313 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,608 views
0 votes
1 answer

Vertically centering text in a div

Try this code: .smallUnitBox { ...READ MORE

answered Sep 3, 2018 in Blockchain by digger
• 26,740 points
879 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP