How to Link to a PHP File

Save

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" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <title>Linking Page</title>

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

    </head>

  • 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:

    <body>

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

    </body>

    </html>

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

References

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

Comments

You May Also Like

Related Searches

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