How to Link to a PHP File


A website is made up of Web pages. Users move between Web pages through links that direct them to other Web pages. A Web page can be an HTML file or it can be a file in a scripting language such as PHP that outputs HTML code. Since both HTML and PHP files are considered Web pages, you can link to a PHP file the same way you link to any Web page in a website.

  • Create a new HTML file using an HTML editor or Notepad.

  • Insert the HTML header information. For example, type:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">



    <title>Linking Page</title>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


  • Insert a link to a PHP file using the HTML "<a>" tag. Specify the name of the PHP file with the "href" parameter. For example, type:


    <a href="phpfile.php">Run PHP file</a>



  • Exit the editor and save the file. Navigate to the "phplink.html" file in a browser and test that it functions correctly.

Related Searches


  • Photo Credit John Foxx/Stockbyte/Getty Images
Promoted By Zergnet


You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!