In Rails there is a helper method for doing just that. When you click the link, it creates a form and hidden submit button on the fly and submits that form. Here is what it generates (with linebreaks added for readability):
<a href="/images/9" onclick="if (confirm('Are you sure?')) {
var f = document.createElement('form');
f.style.display = 'none';
this.parentNode.appendChild(f);
f.method = 'POST';
f.action = this.href;
var m = document.createElement('input');
m.setAttribute('type', 'hidden');
m.setAttribute('name', '_method');
m.setAttribute('value', 'delete');
f.appendChild(m);
f.submit(); };
return false;">Delete Image</a>
Obviously your href would be mypage.php rather than /images/9, but in this example you would have access to $_POST['value'] == "delete".