<?php
if (isset($_POST["Field_Name"]) && isset($_POST["Field_Value"]) && isset($_POST["Value_Type"]) && isset($_POST["CoCode"])) {
    $fldName = $_POST["Field_Name"];
    $fldValue = $_POST["Field_Value"];
    $CoCode = $_POST["CoCode"];
    $Value_Type= $_POST["Value_Type"]; 
    if($Value_Type=='S' || $Value_Type=='D'){
        $sql = "UPDATE company SET $fldName='" . $fldValue . "' WHERE comp_code like '$CoCode'";
    } else {
        $sql = "UPDATE company SET $fldName=" . $fldValue . " WHERE comp_code like '$CoCode'";    
    }
    
    include_once('opendb.php');
    if ($conn->query($sql) === TRUE) {         
        echo("OK");
    } else {
        echo("Error in updation");
    }
     $conn->close();
} else {
    echo "Parameters missing" ;
}
