Skip to main content
Topic: want to add action in status checkbox (Read 1113 times) previous topic - next topic

want to add action in status checkbox

I wanted to add action in status checkbox

 <?php
if($data['Status'] == 1)
{
?>
<a href="javascript:void()" title="Enable" class="btn btn-sm btn-default" onClick="Disable('<?=$data['id']?>')"><i class="fa fa-check-circle text-success"></i></a>
<?php
 }
 else
{
?>
<a href="javascript:void()" title="Disable" class="btn btn-sm btn-default" onClick="Enable('<?=$result['id']?>')"><i class="fa fa-times-circle text-danger"></i></a>
<?php } ?>

function Disable(id){ window.location="action=disable&sid="+id;}
function Enable(id){ window.location="action=enable&sid="+id; }

public function disable($id){
global $conn;
$disableSql = mysqli_query($conn,"UPDATE products SET Status=0 WHERE id='".$id."'"); }

public function enable($id){
global $conn;
$disableSql = mysqli_query($conn,"UPDATE products SET Status=1 WHERE id='".$id."'");
}