I posed a question previously but I think in the wrong way.
Currently I have a form submit that works to post "toggle_LED" but I want to avoid a form and only use a button to post from my HTML or PHP if possible? As I have a setup that checks for the post of "toggle_LED" for both a readout of what state the LED is in and another that switches the LED if the MySQL database is updated via a POST.
This is one place I want to use it for a little ESP_8266 project.
if (isset($_POST['toggle_LED'])) {
$sql = "SELECT * FROM LED_status;";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
if($row['status'] == 1){
$update = mysqli_query($conn, "UPDATE LED_status SET status = 0 WHERE id = 1;");
}
else{
$update = mysqli_query($conn, "UPDATE LED_status SET status = 1 WHERE id = 1;");
}
}