I have a table like this:
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Usernames</th>
<th scope="col">number</th>
<th scope="col">Type</th>
<th scope="col">Date</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
foreach($projects as $project)
{
echo '<tr>';
echo '<th>'.$project['id'].'</th>';
echo '<td>'.$project['user'].'</td>';
echo '<td>'.$project['number'].'</td>';
echo '<td>'.$project['user_type'].'</td>';
echo '<td>'.$project['logs'].'</td>';
echo '<td><a href="view-details" class="btn btn-sm btn-primary" id="view_files" ">View</a></td>';
echo '</tr>';
}
?>
</tbody>
</table>
I am trying to render the details of the table above on another div (shown below) in the same page but on another window view pane using the 'View' button.
<div class="row my-4">
<div class="col-12 col-md-6 col-lg-3 mb-4 mb-lg-0">
<div class="card">
<h5 class="card-header">Customers</h5>
<div class="card-body" id="more-info">
<h5 class="card-title">
<?php echo $post['id']; ?>
</h5>
<p class="card-text">
<?php echo $post['user']; ?>
</p>
<p class="card-text text-success">
<?php echo $post['catch_code']; ?>
</p>
</div>
</div>
</div>
The foreach in the first example is been iterated with the "view" button for each element. I need each element to be displayed as I click 'View' on it. I was worried if clicking "view" then all elements will be displayed, being that the iteration is the same as the id on the View button..
Please kindly propose a solution for me.