I tried making a delete button but if I use a checkbox it works fine but wont work without can anyone assist me my code is as follows:
I added my whole code for table where i'm wanting to delete an entry via a button hope this is more useful.
<?php
if (isset($_POST['rBtn'])) {
$sql = $odb->prepare("DELETE FROM `fe` WHERE `ID` = :id");
$sql->execute(array(':id' => $id));
$notify = '<div class="btn btn-outline-success btn-sm" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><i class="mdi mdi-check-all"></i>API has been deleted!</div><meta http-equiv="refresh" content="2;url=customers.php">';
}
?>
<div class="card-body">
<form action="" method="POST" class="form-horizontal">
<table id="bootstrap-data-table-export" class="table table-striped table-bordered">
<thead>
<tr>
<th>IP</th>
<th>Type</th>
<th>Name</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$SQLSelect = $odb->prepare("SELECT * FROM `fe` WHERE `userID` = :user ORDER BY `ID` DESC");
$SQLSelect->execute(array(':user' => $_SESSION['ID']));
while ($show = $SQLSelect->fetch(PDO::FETCH_ASSOC)) {
$ipShow = htmlspecialchars($show['ip']);
$noteShow = htmlspecialchars($show['note']);
$ids = intval($show['ID']);
$date = htmlspecialchars(date("d-m-Y, h:i:s a", $show['date']));
$type = $show['type'] == 'f' ? '<button class="btn btn-success btn-sm">Friend</button>' : '<button class="btn btn-danger btn-sm">Enemy</button>';
echo '<tr><td>' . htmlspecialchars($ipShow) . '</td><td>' . $type . '</td><td>' . htmlspecialchars($noteShow) . '</td><td>' . htmlspecialchars($date) . '</td><td><input type="submit" value="Delete" name="rBtn" class="btn btn-outline-danger btn-sm" /></td></tr>';
}
?>
</tbody>
</table>
</form>
</div>