PHP CRUD : How to delete data from database in PHP MySQL

How to Delete data from database in php

Hie Guys, this is the Final one Part 4- where we are going to delete the record from database in php from the student table. we already have fetched data in table where we have a Delete Button where we click to delete the data. 

Step 1: Create a file named delete.php and there is 2 files included to delete this task.(Link Above)

remainder that, this is how it looks: index.php file

    <form action="delete.php" method="post">
       <input type="hidden" name="id" value="<?php echo $row['id'?>">
       <input type="submit" name="delete" class="btn btn-danger" value="DELETE"> 

and the main file delete.php


$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection'phpcrud');

    $id = $_POST['id'];

    $query = "DELETE FROM student WHERE id='$id";
    $query_run = mysqli_query($connection$query);

        echo '<script> alert("Data Deleted"); </script>';
        echo '<script> alert("Data Not Deleted"); </script>';