<?php
//setting header to json 
    header('Content-Type: application/json');
    header("Access-Control-Allow-Origin: *");

    $address = $_POST["a"];  // get internal sensor id from js
    $newDriverID = $_POST["d"];  // get value
    require '../php/database.php';

    
    // $sql = "UPDATE ds18b20 SET `name`='$name' WHERE `address`='$id'";
    $sql = "UPDATE i2cDevices SET `i2cDriverID`='$newDriverID' WHERE `decAddress`='$address'";
    
    if ($mysqli->query($sql) === TRUE) {
        echo "Widget Visible updated successfully";
    } else {
        echo "Error: " . $mysqli->error;
    }

    //close connection
    $mysqli->close();
?>