Hi,
I have the following javascript to confirm I want to delete something:
// script confirming deletion of items
function confirmDelete(id,module,section,name) {
if (confirm('Are you sure you want to delete the following: \n\n"' + name +'"')) {
window.location = ('?module=' + module +'§ion=' + section +'&type=delete&id=' + id +'&name=' + name);
} else {
return false;
}
}
This is the code for the "Delete Item" link next to each entry I pull out of the database:
echo "<p>" .$row['fld_name']. " - <a href=\"?module=" .$module. "&section=" .$section. "&type=edit&id=" .$row['fld_id']. "\">Edit</a> -
<a href=\"javascript:;\" onclick=\"confirmDelete('" .$row['fld_id']. "','" .$module. "','" .$section. "','" .htmlspecialchars(addslashes($row['fld_name'])). "')\">Delete</a></p>
This is then the scripting that actually deletes the file:
// get form values
$id = $_GET['id'];
$sql = "DELETE FROM tbl_press WHERE fld_id='$id'";
if ($debug == 1) {
$result = mysql_query($sql) or die ("Error in query: $sql. " .mysql_error());
} else{
$result = mysql_query($sql) or die ("There has been an error with your request, please try again later.");
}
echo "<div id=\"formerror\">";
echo "<p><strong>Message:</strong> Article deleted succesfully. <a href=\"?module=" .$module. "&section=" .$section. "#search\">Would you like to delete more?</a></p>";
echo "</div>";
This works fine in Firefox, but not in IE. I get the confirmation box, but when I click ok nothing happens...any ideas? I saw this in a magazine article so thought it would be ok to use - obviously I was wrong or I have complicated it by assigning so many variables.
I've tried to change window.location to a simple url such as google.com but nothing happens still.
Cheers,
Chris