Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

How to included a PHP file in an html page
(1 viewing) (1) Guest
All your queries regarding
PHP Installation,
Binding Apache-PHP-MySQL,
and tonnes more... will be solved in this forum
  • Page:
  • 1
TOPIC:

How to included a PHP file in an html page

How to included a PHP file in an html page 1 year, 10 months ago #33

  • andrew
  • OFFLINE
  • Junior Boarder
  • Posts: 22
  • Karma: 0
I'm building a web page which has mostly static contents. Only one section of the page has to be generated based on the data from a text file. I wrote a PHP script to display that section. When I execute the script as a standalone script it displays the section correctly. Now I want to include this script in the html file .How do I do this?

I tried:
<?php include "head.php" ?>

where the dynamic page was to be displayed in the HTML file. But the page displays only the static contents. Is there any other way to execute the script from the html page?

Re:How to included a PHP file in an html page 1 year, 10 months ago #44

  • isaac
  • OFFLINE
  • Senior Boarder
  • Posts: 64
  • Karma: 0
what's the extension for this file? html? php? It must be php in order to execute the php code
Here's your file:
....
....
html code
....
....

<? include('head.php'); ?>
....
....
more html code
....
....
  • Page:
  • 1
Time to create page: 1.39 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download