Gilead - 8:09 pm on Nov 4, 2011 (gmt 0)
I have an table set up so you can view all the people in the database with a link to either edit or delete.
The link is generated on the viewmember page: <a href="editmember.php?id=' . mysql_result($result, $i, 'contactid') . '">Edit</a></td>';
I want to confirm an admin's action so they do not delete by mistake. When I tried an ...onclick="confirm"... inside that link, I kept getting an error. I suspect there are too many ' or " and it's getting confused.
So I went to confirm via a form on the actual delete page
<form action="<?=htmlentities($_SERVER['PHP_SELF']);?>" method="PO">
<input type="submit" name="Yes" value="yes" />
<input type="submit" name="No" value="no" />
Deletes a specific entry from the members table
// connect to the database
$result("DELETE FROM $table_name WHERE id= '".$_GET[id]."'" ) or die(mysql_error());
header( 'Location: viewmembers.php');
else if (isset($_GET['no']))
The address initially shows that the id is being carried over in an page.php?id=#*$!x, but when they click on yes or no to confirm, the id is lost. I changed from post to get and it proved that it was lost.
Am I even using the right approach? Is there a better way to ask for confirmation in this setting?