Answers for "toggle switch php"

PHP
0

toggle switch php

//html
<span id="setQuickVar1">Enable Notifications<input id="QuickVar1" type="checkbox" class="make-switch" data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF" ></span>
                                  <div id="resultQuickVar1"></div>

//js
$('#setQuickVar1').on('click', function() {
    var checkStatus = this.checked ? 'ON' : 'OFF';

    $.post("quickRightSidebarDBUpdate.php", {"quickVar1a": checkStatus}, 
    function(data) {
        $('#resultQuickVar1').html(data);
    });
});

//php
if (isset($_POST['quickVar1a'])){
    $quickVar1a = $_POST['quickVar1a'];
    $query2 = "UPDATE test SET field1 = '".$quickVar1a."' where field1 != '".$quickVar1a."'";
}
Posted by: Guest on August-06-2021

Code answers related to "toggle switch php"

Browse Popular Code Answers by Language