xxxxxxxxxx
If you want to do this only in PHP, you will need to add "steps" in your script, like:
step1 (show form) -> step2 (ask validation) -> step3 (validate)
To do so, you can use sessions to keep form content, and GET parameter to track the step. Otherwise the simplest solution is to use javascript:
echo "<td><a onClick=\"javascript: return confirm('Please confirm deletion');\" href='delete.php?id=".$query2['id']."'>x</a></td><tr>"; //use double quotes for js inside php!
xxxxxxxxxx
<?php
$alert_script;
$error;
//Put this POST block right at the top of the page.
if ($_POST['confirm'] !== 1) {
$alert_script = "<script>alert(\'You have to tick the box\')</script>";
$error = true;
} else {
$error = false;
}
if (!$error) {
//complete the action code/call another file.
}
?>
xxxxxxxxxx
<input type="button" value="Rate Request" onclick="return comfirm('Are you sure want to delete');" />