Hi
I am trying to update the ON / OFF status through the below code.
If i change the OFF status to ON, its getting a value is OFF. can any one please help to fix the issue.
toggle.php
<div id="setQuickVar1"> <input type="checkbox" data-switchery <?php if($SCYQ64EV01=='Y') echo 'checked'; ?> /> </div> <span class="uk-form-help-block"> <div id="resultQuickVar1"></div> </span> <script type="text/javascript">
$(document).ready(function() {
$('#setQuickVar1').on('click', function() {
var checkStatus = this.checked ? 'ON' : 'OFF';
alert(checkStatus);
$.post("engineDBUpdate.php", {"quickVar1a": checkStatus},
function(data) {
$('#resultQuickVar1').html(data);
});
});
});
</script>
EngineDBUpdate.php
<?php
if (isset($_POST['quickVar1a']))
echo $quickVar1a = $_POST['quickVar1a'];
?>