<?php
include('dbconnection.php');

if ($con->connect_error) {
    die("Connection failed: " . $con->connect_error);
}

$id = 1;

// If toggle is sent
if (isset($_POST['toggle'])) {
    $toggle = intval($_POST['toggle']);
    $con->query("UPDATE Toggle_SMS SET Toggle='$toggle' WHERE id=$id");
}

// If message is sent
if (isset($_POST['message'])) {
    $message = $con->real_escape_string($_POST['message']);
    $con->query("UPDATE Toggle_SMS SET Message='$message' WHERE id=$id");
}

echo "success";
?>
