I have a mysql data which I call to display to my PHP table and then for example I clicked the username01, I wanted to call the other columns of that username01 (e.g. password01, id01) to display to my modal fields. Here's my code:
PHP
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" ?> <a href="#?<?php echo $row['id']; $id; ?>" onclick="document.getElementById('id01').style.display='block'" style="width:auto;"> <?php echo "<font color='blue'>" . $row['ipaddress'] . "</font></a></td>";
echo "<td>" . $row['name'] . "</td>";
Modal
<?php
include 'includes\dbconn.php';
$query = mysqli_query($conn,"SELECT * from devopstbl where id=$id");
$ipaddress = $row['ipaddress'];
$name = $row['name'];
$department = $row['department'];
?>
<div id="id01" class="modal">
<form class="modal-content animate" method="GET" action="ipaddress.php">
<div class="imgcontainer">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Exit">×</span>
<img src="images/avatar.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="ipaddress"><b>Username <?php echo $username; ?></b></label>
<input type="text" pattern="[a-zA-Z0-9\s]+" name="username" value="<?php echo $ipaddress; ?>" required>
Apparently.. the $id only gets the id01 even i clicked the other data like id02 etc. and does not get its other columns like username01 password01.. Am i missing something?