<?php

require_once('connect.php');

// Created by Ilhomjon on 30.09.2020

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

    if ($_POST['agent_id']!="" && $_POST['zakaz_txt']!="" ) {

        $agent_id = $_POST['agent_id'];
        $kontr_id = $_POST['kontr_id'];
        $zakaz_txt = $_POST['zakaz_txt'];
        $vaqti = $_POST['vaqti'];
        $zakaz_raqam = $_POST['zakaz_raqam'];
        $zakaz_int = $_POST['zakaz_int'];
 
        
       $zakaz_txt = str_replace("'", "`", $zakaz_txt);


        mysqli_set_charset($conn,"utf8");
        $query = mysqli_query($conn,"SET NAMES utf8");
 

        $query = "INSERT INTO zakaz (agent_id, kontr_id, malumot, vaqti, zakaz_raqam, zakaz_int) VALUES ('$agent_id','$kontr_id','$zakaz_txt','$vaqti','$zakaz_raqam','$zakaz_int')";

                
        // file_put_contents("sqllar.txt", $query, FILE_APPEND);

        if(mysqli_query($conn, $query)){
         echo "ok";
        }else{
         echo "no";

        }


    }else{
          echo "no_c";
    }
}
else
{
     echo "error";
}

$conn->close();
?>
