delete link to delete items using javascript
Posted: Tue Jul 24, 2007 10:19 am
hi, i have a code here for deleting a record
and i have a javascript code so the end user wil be prompted confirming the deletion of this record
the problem is that when i tried to delete a record, it returns nothing.please help.
Code: Select all
<a href="edit.php?eid=<?php echo $akey; ?>" name="edit">edit</a> |
<a href="" name="delete" onclick="return setDeletemode(<?php echo $akey; ?>, true)">delete</a>
if (isset($_POST['delete'])) {
$del = delete_language_caption($eid);
if ($del) {
echo "<b>Successfully deleted this record.</b><br>";
echo "<meta http-equiv=\"refresh\" content=\"2;url=index.php\">";
} else {
echo "system error.";
}
}Code: Select all
function setDeletemode(lkey)
{
mode = 'del';
//lang_key = lkey;
var answer = confirm("Are you sure you want to delete this item?");
if (answer){
return true;
} else {
return false;
}
}