<?php
    include 'load.php';
    require_once 'db_connection.php'; 
    
    
    
    if(isset($_POST['tax'])){
        $tax =  $_POST['tax'];
        $lastchar = substr($tax, -1); 
        if($lastchar=="%"){
            $dis = intval(substr($tax, 0, -1));
            $distype = 1;
        }else{
            $dis = $tax;
            $distype = 0;
        }

       $sql = "UPDATE tax SET tax='$dis',tax_type='$distype' WHERE tax_id ='1'";
 
        if ($conn->query($sql) === TRUE) {
             echo 1;
        }else{
             echo 0;
        }
     }
     
?>