I have a table whose view is something like this

ID  NAME  LOCATION  DELETE
1   sam   US        delete

I have a statement from the table that deletes the given row

echo "<td><a href=\"delete_members.php?id=".$row['id']."\">Delete</a></td>";

It redirects to delete_members.php page and the row gets deleted, however i wish to display an alert box that makes sure that the user wants to delete the row or not. for it i have a code

code for the delete_members.php page

<?php
include('admin_session.php');
$con=mysqli_connect("abc.com","abc","abc","abc");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$id = $_GET['id']; 

mysqli_query($con,"DELETE FROM members WHERE id='".$id."'");
mysqli_close($con);
header("Location: admin_member_list.php");
?> 

However, i am unable to use the confirmation script with the statement in a proper way. i want that the alert box gets popped up after i click on the edit button that is present on the first statement given above and then if the user confirms it should run the delete_members.php script. would appreciate if someone could guide me

Use the onclick of the a tag to popup a dialog. If it returns false processing stops. If it returns true your delete script will be called.

You can use the onclick attribute as pritaeas suggested, together with the JavaScript confirm() function to give a popup with Yes or No options:

echo "<td><a href=\"delete_members.php?id=".$row['id']."\" onclick="return confirm('Are you sure you wish to delete this item?');">Delete</a></td>";

If the user clicks Yes, the function returns true, and the link is followed. If the user clicks No, the function returns false, and nothing happens.