passing variables using a href tag through foreach loop
Discarding security issues, this works for me:
<table class="table table-bordered">
<tr>
<th>ID</th>
<th>Name</th>
<th>Year</th>
<th>Action</th>
</tr>
<?php foreach($tl as $rowtl): ?>
<tr>
<td><?= $rowtl->idTL; ?></td>
<td><?= $rowtl->nameTL; ?></td>
<td><?= $rowtl->year; ?></td>
<td>
<a href="read_event.php?idTL=<?=$rowtl->idTL;?>&nameTL=<?=$rowtl->nameTL;?>" class="btn btn-info">Read</a>
<a onclick="return confirm('Are you sure you want to delete this entry?')" href="delete_event.php?idTL=<?= $rowtl->idTL ?>" class='btn btn-danger'>Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
Comments
Post a Comment
Under your writing