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.
Instructions
-
-
1
Create a new HTML file using an HTML editor or Notepad.
-
2
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>
-
-
3
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>
-
4
Exit the editor and save the file. Navigate to the "phplink.html" file in a browser and test that it functions correctly.
-
1
References
- Photo Credit John Foxx/Stockbyte/Getty Images