Remove this code immediately. This post gives one reason why. GET
requests should never modify anything on the server, especially not deleting.
Instead, you should look into using AJAX. For example:
echo "<a href=\"javascript:remove(this,'".$nameskey."');\">Remove</a>";
And:
<script type="text/javascript">
function remove(link,key) {
var a = new XMLHttpRequest();
a.open("POST","delete.php",true);
a.onreadystatechange = function() {
if( this.readyState == 4 && this.status == 200) {
// assuming the link is a direct child of the element to be removed
link.parentNode.parentNode.removeChild(link.parentNode);
}
};
a.send("action=remove&key="+key);
}
</script>