Search⌘ K
AI Features

Linking to Other Pages

Explore how to link between PHP pages by adding navigation links on your homepage. Understand how clicking these links triggers GET requests to serve dynamic content, helping you manage page transitions and improve user experience in your PHP applications.

Adding a link on the homepage

A page that shows a random number seems like a very useful thing. But visitors of our website won’t even know that it exists because they don’t know that they have to go to /random.php for it. A good solution would be to add a link to /random.php on the homepage. Update the body of index.html so it contains such a link:

HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Index</title>
</head>
<body>
<h1>This is the homepage</h1>
<p><a href="/random.php">Get yourself a random number</a></p>
</body>
</html>

Open the homepage in your ...