How to insert iframe with php

Written by declan maher
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to insert iframe with php
Include information in a web page using an iFrame. (Jupiterimages/Comstock/Getty Images)

PHP is a web development programming language used to create websites. It is an open source language, which means that it is free to use. It is often used with a MySQL database, which is also open source. An iFrame is a simple floating frame, placed on a website page, to include code from a separate source. The content within the iFrame can come from a separate file within the same site or from a separate website. You can use it to include posts from Facebook or Twitter.

Skill level:


  1. 1

    Open Notepad and create a PHP file called "index.php."

  2. 2

    Add the following code to the index.php page and save the file:


    <head>PHP IFrame<head>


    <h2><font face="arial" colour="green"></font></h2>

    <Iframe src="include.php" width="300" height="600" border="1"></Iframe>



    You can change the width and height attributes of the iFrame tag to suit your website.

  3. 3

    Create a new PHP file called "include.php" and add the following code:


    This code will show debugging information from PHP when it is included in the file. Save the file.

  4. 4

    Open the index.php file in a browser and you will see that the php debugging code appears on the page, from the included PHP file.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.