I currently have a friends.php page, which outputs a list of a logged-in members friends. Next to each friends is a link to delete a friend:
<a href="wipecontact.php?f_id=' . $fid . '&m_id=' . $logOptions_id . '">Delete Friend</a>
The wipecontact.php is just pure code that deletes the relationship from a MySQL table and looks like this:
include_once "scripts/connect_to_mysql.php";
if (($_GET['f_id']) && ($_GET['m_id'])) {
$f_id = $_GET['f_id'];
$m_id = $_GET['m_id'];
$del_friend = 'mysql_query("DELETE FROM friends WHERE (($f_id IN (requesting_id, requested_id)) AND ($m_id IN (requesting_id, requested_id)))") or die (mysql_error())';
} else {
echo"something went wrong with deleting your friend :(";
exit();
}
?>
Everything works fine, but how can I add a javascript (or jquery etc.) pop-up that lets the user confirm the deletion before proceeding to the MySQL delete query. I am just looking for something simple, without having to alter my code too much.
Note that I need the pop-up to come up before running the mysql query! I'm having trouble getting around this. I'm sort of new to javascript, but I can read it when its all put together. Thanks.