I have a table with a delete <a>
tag. I already can delete data. But what I want to do is put a yes or no warning if the user wants to really delete it. I try JavaScript but I can't make it work.
This is my code
<?php
$action = '';
if(isset($_GET['action']))
$action=$_GET['action'];
if($action=='delete')
{
$speakerid=$_GET['speakerid'];
$delete = mysqli_query($conn, "DELETE FROM accounts WHERE id=$speakerid");
header("Location:accountList.php");
}
?>
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td><?php echo $row['firstname'];?></td>
<td><?php echo $row['lastname'];?></td>
<td><?php echo $row['emailaddress'];?></td>
<td><?php echo $row['contactnumber'];?></td>
<td><?php echo $row['status'];?></td>
<td><?php echo $row['date_added'];?></td>
<td align='center'><?php echo "<a style='padding:6px; background-color:red; color:white; border-radius: 3px;' href='accountList.php?action=delete&speakerid=".$row['id']."'>delete</a>";?></td>
</tr>
<?php endwhile;?>