html - Send static data from one php to another

one text

Solution:

As @pavel pointed out, using a URL parameter should work for you. Every item must have a unique number or name associated with them.

Do not use their array index or similar, because that will change in the future.

Your example code has $row use numeric indexes - whichever one of them is unique you can use as a URL parameter. If you don't have one, you have to create one. Preferably one that will not change when the data is updated. That is where databases will use numeric IDs, but you can use a string as well, as long as you can identify the item from the details.php.

Example link: $link="details.php?id=" . $row[2];. Replace 2 with whatever is a unique number / name for every row.

Instead of only supplying the $row in your function, you can supply the row's ID as a separate parameter if that is what you need. Depends on how you organized this outside of your example code.

In this case you change the function as well:

function showAsItem($row, $rowId) {
  // ...
  $link="details.php?id=" . $rowId;
  // ...
}

In details.php you can access this variable with $_GET: https://www.php.net/manual/en/reserved.variables.get.php

$id = $_GET['id'];

Source