I am pretty sure that you are calling php function on onclick
attribute of the button
which is wrong you cannot call directly server side
functions on the html element's attribute
While using codeigniter
make a function in your controller and place the anchor
tag instead of button like
<table class="images">
<tr>
<br/>
<? foreach($images as $image) { ?>
<td>
<a href="assets/uploads/<?= $image->filename ?>" rel="lightbox" title="<?= $image->filename; ?>">
<img src="<?php echo base_url();?>assets/uploads/<?= $image->filename; ?>" width="200px">
</a>
<?= '<a title="Delete" href="'.site_url().'controller/delete_files/'.$image->filename).'"><br/>'; ?>
</td>
<? } ?>
</tr>
</table>
In your controller make a function delete_files()
function delete_files($image_name){
// write the code to delete or unlink $image_name
unlink('ROOT PATH'.$image_name);
}