未定义的索引ID .. PHP [重复]

I'm trying to delete some data from a table in a mysqli database, and I receive that error. I tried with isset, writing it directly without using a variable, nothing works. What am I doing wrong?

<?php

echo"hello";

$link = mysqli_connect("localhost", "root", "", "documents");

if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}


$ID = $_POST['id'];

$result =  mysqli_query($link, "DELETE FROM document WHERE id='$ID'");


header("Location: connect-db.php");
?>
</div>

If you are fetching id from URL then use

$ID =isset( $_REQUEST['id']) ? $_REQUEST['id'] : 0; 

OR

$ID =isset( $_GET['id']) ? $_GET['id'] : 0;

If you are fetching id from POST variables then use

$ID =isset( $_POST['id']) ? $_POST['id'] : 0;

$ _REQUEST , $ _POST or $ _GET are special functions of PHP that are used to get variables from a user-filled form. While using these functions, a user may encounter an error - Notice: Undefined index. This error can be avoided with the help of PHP isset (). so you just have to check if the index exists or not before you use them.