I'm trying to make software that creates a job board where you can add jobs and maintenance guys can check them off as they go. My problem is getting the request_ID of my table to my SQL query at the bottom in deleteData(). I've tried so much, any tips will be a lot of help.
I have to be making this hard than it needs to be. Im literally just trying to click a button, pop up a form, ask if the user has completed the job, then remove it from the table.
<!DOCTYPE html>
<html>
<head>
<script>
function complete() {
  document.getElementById("myForm").style.display = "block";
}
function closeForm() {
  document.getElementById("myForm").style.display = "none";
}
 
</script>
<link rel="stylesheet" href="styles.css">
<title>KCHC Work Orders</title>
</head>
<?php
        $host = "localhost";
        $user= "";
        $password = "";
        $database="workorders";
        $DBConnect = @new mysqli($host,$user,$password,$database);
        if ($DBConnect->connect_error)
        echo "The database server is not available at the moment. " .
        "Connect Error is " . $DBConnect->connect_errno .
        " " . $DBConnect->connect_error . ".";
        else{
        echo "Connection made";
        }
    ?>
<header>
    <div class="menu">
        <nav>
            <a href="orderform.php">Create a Request</a>
        </nav>
    </div>
</header>
<body>
    <?php
    $sql = "SELECT request_id, name, date, location, description FROM requests";
    $stmt = $DBConnect->query($sql);
    
    if ($stmt->num_rows > 0) {
        echo '<div class="request_box">';
        echo '<table id="myTable" ><tr><th>ID</th> <th>Name</th> <th>Date</th> <th>Location</th> <th>Description</th> <th>Complete?</th> </tr>';
    while (($Row = $stmt->fetch_assoc()))
    {
    echo "<tr id=";
    echo $Row['request_id'] . ">";
    echo "<th>" . $Row['request_id'] . "</th> <th>" . $Row['name'] . "</th> <th>" . $Row['date'] . "</th> <th>" . $Row['location'] . "</th> <th>" . $Row['description'] . "</th> <th>" . '<input type="button" onclick="complete()" value="' . $Row["request_id"]. '" />' . "</th></tr>";
    }
    echo "</table> </div>";
    
    }
    else{
        echo '<div class="request_error">';
        echo "<p> There are no jobs to complete!</p> <br>";
        echo "<p> If you think there should be, please contact Matt or his genius son</p>";
        echo '</div>';
    }
    
    function sendit($i){
        $newId = $i;
    }
?>
`
<div class="popup" id="myForm" >
  <form id="formReal" method="post">
    <h1>Would you like to remove this job? </h1>
    <input type="submit" class="btn" onclick="" submit="<?php deleteData() ?>" value="Remove from List" />
    <button type="button" class="btnCancel" onclick="closeForm()">Cancel</button>
  </form>
</div>
</body>
<?php
function deleteData(){
    global $DBConnect;
    $id_new = $newId;
    $sql = "DELETE FROM requests WHERE request_id = 3";
    $stmt = $DBConnect->query($sql);
    } 
?>
 
    