john oliver john oliver - 2 months ago 6
PHP Question

How to popup the confirm button?

I cannot figure out where to put my

onclick = "return confirm('Are you sure?')
due to lot of concatenation in my case so please help me guys. here is my code:

echo "<td><a href='" . base_url().'admin/play/delete/' .$row->id."onclick="."return confirm('Are you sure?')".'>" . "<img src='".base_url()."admin_css/images/delete.png' title='delete' "/></a>"/></a>"."<a href='".base_url().'admin/play/fav/' . $row->id . "'>" ."<img src='".base_url()."admin_css/images/star.png' title='edit'/>"."</a></td>";

Need help.


Make it simple

       <a href="<?php echo base_url(); ?>admin/play/delete/<?php echo $row->id; ?>" onclick="return confirm('Are you sure?')">
       <img src="<?php echo base_url(); ?>admin_css/images/delete.png" title="delete"/>
       <a href="<?php echo base_url(); ?>admin/play/fav/<?php echo $row->id; ?>">
       <img src="<?php echo base_url(); ?>admin_css/images/star.png" title="edit"/>