How to pass parameters with a href
index.php
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>Pass value (parameter) to link destination</title>
<link rel="stylesheet" href="./styles/main.css" />
</head>
<body>
<h1>Original page</h1>
<!--Pass id = 1 and name = value to the landing page-->
<p><a href="next.php?id=1&name=value
">next
</a></p>
</body>
</html>
next.php
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>Receive a value (parameter) at the link destination</title>
<link rel="stylesheet" href="./styles/main.css" />
</head>
<body>
<h1>Landing page</h1>
<?php
// Receive a value with $ _GET function
$id = $_GET['id']; // Receive id and assign it to variable
$name = $_GET['name']; // Assign name to variable
//output
echo $id ."<br />\n"; // Output the variable id
echo $name; // Output variable name
?>
</body>
</html>
result
1
value