Hi I am wondering if it's possible to do something like selecting a row within a datatable and have a button "delete" with a method in the controller.
My delete button is to remove the row from the database itself and refresh the page.
This is what my view contains:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#datatables').DataTable();
});
</script>
<table id= "datatables" class = "table">
<thead>
<tr>
<th> Patient Name </th>
<th> Patient`enter code here` ID </th>
</tr>
</thead>
<tbody class = "list">
<?php foreach ($patients as $patient): ?>
<tr>
<td><?=$patient->first_name ?></td>
<td><?=$patient->patientID ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
(delete button) echo anchor('something/delete', 'Delete', 'class= "some class"');
What i want to do is:
Get the id of the selected row in the datatable and pass it to another page in a controller for processing.
Is that possible?
<?php echo anchor('something/delete/' . $patient->patientID, 'Delete', 'class= "some class"'); ?>?