toggle switch php

Solutions on MaxInterview for toggle switch php by the best coders in the world

showing results for - "toggle switch php"
Jan
23 Apr 2018
1//html
2<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>
3                                  <div id="resultQuickVar1"></div>
4
5//js
6$('#setQuickVar1').on('click', function() {
7    var checkStatus = this.checked ? 'ON' : 'OFF';
8
9    $.post("quickRightSidebarDBUpdate.php", {"quickVar1a": checkStatus}, 
10    function(data) {
11        $('#resultQuickVar1').html(data);
12    });
13});
14
15//php
16if (isset($_POST['quickVar1a'])){
17    $quickVar1a = $_POST['quickVar1a'];
18    $query2 = "UPDATE test SET field1 = '".$quickVar1a."' where field1 != '".$quickVar1a."'";
19}
20