<?php

require 'db.php';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
if(isset($postdata) && !empty($postdata))
{

$app_name = mysqli_real_escape_string($con, trim($request->form_value->appname));
$cart = mysqli_real_escape_string($con, trim($request->form_value->cartvalue));
$cur = mysqli_real_escape_string($con, trim($request->form_value->currency));
$max_km = mysqli_real_escape_string($con, trim($request->form_value->distance));
$free_deli_value = mysqli_real_escape_string($con, trim($request->form_value->free_delivery));
$loc = mysqli_real_escape_string($con, trim($request->form_value->location));
$tax = mysqli_real_escape_string($con, trim($request->form_value->tax));
$starttime = mysqli_real_escape_string($con, trim($request->form_value->start_time));
$endtime = mysqli_real_escape_string($con, trim($request->form_value->end_time));
$shopmessage = mysqli_real_escape_string($con, trim($request->form_value->shop_message));

$sql = "UPDATE setting set app_name = '$app_name',o_min = '$cart',max_km = '$max_km',currency = '$cur',location = '$loc',tax = '$tax',shop_message = '$shopmessage',start_time = '$starttime',end_time = '$endtime',
        free_deli_value = '$free_deli_value' where id = '1'";
    $result = mysqli_query($con,$sql);
    if($result)
    {
        $rows = array('status'=>true,'message' => 'Settings Updated');
        echo json_encode($rows);
    }
}

?>
