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 in PHP by Kithuzzz
• 3,660 points
5 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,740 points
916 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,740 points
893 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,740 points
227 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,740 points
1,691 views
0 votes
0 answers

How to write into a file in PHP?

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

Jun 20 in PHP by Kithuzzz
• 3,660 points
9 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 in PHP by narikkadan
• 11,280 points
13 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
4,729 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,720 points
269 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP