how do i find and fix the error on this PHP code

look at this crud (edit.php) code, every code is working fine except this one i have check everything it looks ok,but i don't know where the wrong is,take a look at my image attachment ,it shows error like this [Undefined Error][1].even there's no error in the editor so i confused

<?php
// including the database connection file
include_once("config.php");

if(isset($_POST['update']))
{   
    $id = $_POST['id'];
    
    $kode_barang = $_POST['kode_barang'];
    $nama_barang = $_POST['nama_barang'];
    $satuan = $_POST['satuan'];
    $banyak = $_POST['banyak'];
    $harga = $_POST['harga'];
    $keterangan = $_POST['keterangan'];
    
    // checking empty fields
    if(empty($kode_barang) || empty($nama_barang) || empty($satuan) || empty($banyak) || empty($harga) || empty($keterangan)) {              
        if(empty($kode_barang)) {
            echo "<font color='red'>Kolom Kode Barang harus diisi.</font><br/>";
        }
        if(empty($nama_barang)) {
            echo "<font color='red'>Kolom Nama Barang harus diisi.</font><br/>";
        }
        if(empty($satuan)) {
            echo "<font color='red'>Pilihan Satuan harus diisi.</font><br/>";
        }
        if(empty($banyak)) {
            echo "<font color='red'>Kolom Banyak harus diisi.</font><br/>";
        }
        if(empty($harga)) {
            echo "<font color='red'>Kolom Harga harus diisi.</font><br/>";
        }
        if(empty($keterangan)) {
            echo "<font color='red'>Kolom Keterangan harus diisi.</font><br/>";
        }
    } else {    
        //updating the table
        $result = mysqli_query($mysqli, "UPDATE users SET kode_barang='$kode_barang',nama_barang='$nama_barang',satuan='$satuan',banyak='$banyak',harga='$harga',keterangan='$keterangan', WHERE id=$id");
        
        //redirectig to the display page. In our case, it is index.php
        header("Location: index.php");
    }
}
?>
<?php
//getting id from url
$id = $_GET['id'];

//selecting data associated with this particular id
$result = mysqli_query($mysqli, "SELECT * FROM users WHERE id=$id");

while($res = mysqli_fetch_array($result))
{

    $kode_barang = $_POST['kode_barang'];
    $nama_barang = $_POST['nama_barang'];
    $satuan = $_POST['satuan'];
    $banyak = $_POST['banyak'];
    $harga = $_POST['harga'];
    $keterangan = $_POST['keterangan'];
}
?>
<html>
<head>  
    <title>Edit Data</title>
</head>

<body>
    <a href="index.php">Home</a>
    <br/><br/>
    
    <form name="form1" method="post" action="edit.php">
        <table border="0">
            <tr> 
                <td>Kode Barang</td>
                <td><input type="text" name="kode_barang" value="<?php echo $kode_barang;?>"></td>
            </tr>
            <tr> 
                <td>Nama Barang</td>
                <td><input type="text" name="nama_barang" value="<?php echo $nama_barang;?>"></td>
            </tr>
            <tr>
            <td>Satuan</td>
            <td>
            <select name="satuan">
                <option value="">Pilih</option>
                <option value="P" <?php echo $satuan == 'P' ? 'selected="selected"' : '' ?>>Kilogram</option>
                <option value="W" <?php echo $satuan == 'W' ? 'selected="selected"' : '' ?>>Unit</option>
             </select>
            </td>
              </tr>   
            <tr> 
                <td>Banyak</td>
                <td><input type="number" name="banyak" value="<?php echo $banyak;?>"></td>
            </tr>
            <tr> 
                <td>Harga</td>
                <td><input type="number" name="harga" value="<?php echo $harga;?>"></td>
            </tr>
            <tr> 
                <td>Keterangan</td>
                <td><textarea name="keterangan"><?php echo $keterangan;?></textarea></td>
            </tr>
            <tr>
                <td><input type="hidden" name="id" value=<?php echo $_GET['id'];?>></td>
                <td><input type="submit" name="update" value="Update"></td>
            </tr>
        </table>
    </form>
</body>
</html>

i edited someone code so i change a lot of thing inside but only this got error [1]: https://i.stack.imgur.com/3EFNg.png [2]: https://i.stack.imgur.com/jDfhX.png

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum