I'm taking data out of the database, I want to create a hyperlink so that when you click on the index, the index data goes to another page. Thanks for the help.
Asked
Active
Viewed 62 times
0
-
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a – ADyson May 22 '23 at 20:59
-
https://stackoverflow.com/questions/668920/passing-variables-and-data-through-a-regular-web-page-link – ADyson May 22 '23 at 21:00
-
1It is a very bad idea to use `die(mysqli_error($$conn));` in your code, because it could potentially leak sensitive information. See this post for more explanation: [mysqli or die, does it have to die?](https://stackoverflow.com/a/15320411/1839439) – Dharman May 22 '23 at 21:08
-
@Guest, by **index** do you mean the **id** of the record or something else? And by **index data** do you mean all data of the record or or something else? – Pippo May 24 '23 at 23:02
1 Answers
0
NOTE: This answer is based on informations previously provided by the asker that now have been removed
This can be a very simple solution:
// execute your query before ...
while($row = mysqli_fetch_object($st)) {
// Let's create a form for each row (I hope there aren't too many...)
// The id is sent via GET parameter, the data is sent via POST
echo <<<HTML
<form method="post" action="create.php?id=$row->id">
<input type="hidden" name="fio" value="$row->FIO">
<input type="hidden" name="phone" value="$row->Phone">
<input type="hidden" name="track" value="$row->Track">
<input type="hidden" name="status" value="$row->Status">
<input type="hidden" name="date" value="$row->Date">
<a href="#" onclick="this.parentNode.submit()">$row->id</a>
| $row->FIO | $row->Phone | $row->Track | $row->Status | $row->Date
<br>
</form>
HTML;
}
I omitted the "\n" because they are not shown in the browser.

Pippo
- 2,173
- 2
- 3
- 16
-
Submitting the row ID back should be sufficient. If the row data isn't going to be edited by the user then there's very little reason to send all of it again – ADyson May 23 '23 at 06:44
-
@ADyson the asker request is a bit ambiguous, i've asked more explanation – Pippo May 24 '23 at 23:03