I just converted some of my HTML
pages to PHP
pages, and I'm not that familiar with PHP
. In my HTML
pages, assuming it's just a static web app, I can link to another page quite simply by playing the following anchor
on the page:
<a href="go-to-this-page.html">This is a link</a>
So, after converting the pages to PHP
in order to make sure that I can template and include templates a bit easier and faster, I don't know how to include these links.
For example, say I have two pages, index.php
, and page2.php
. How would I create an anchor link to this page?
<a href="??????">This is a link</a>
Complete HTML/CSS Course 2022 To make page links in an HTML page, use the <a> and </a> tags, which are the tags used to define the links. The <a> tag indicates where the link starts and the </a> tag indicates where it ends. Whatever text gets added inside these tags, will work as a link.
It is possible to insert the content of one PHP file into another PHP file (before the server executes it), with the include or require statement. The include and require statements are identical, except upon failure: require will produce a fatal error (E_COMPILE_ERROR) and stop the script.
Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to use the PHP. Step 2: Now, we have to place the cursor in any tag of the <body> tag where we want to add the code of PHP. And, then we have to type the start and end tag of PHP.
Use like this
<a href="index.php">Index Page</a>
<a href="page2.php">Page 2</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With