<?php

$request_body = file_get_contents('php://input');
$data = json_decode($request_body, true);


$first_name = $data["first_name"];
$last_name = $data["last_name"];
$phone = $data["phone"];
$street = $data["street"];
$house = $data["house"];
$post_code = $data["post_code"];
$city = $data["city"];

if($phone) {

    require './save_data.php';

    $data = [
        'First Name' => $first_name,
        'Last Name' => $last_name,
        'Phone' => $phone,
        'Street' => $street,
        'House number' => $house,
        'Post code' => $post_code,
        'City' => $city,
    ];

    $response = saveData($data);

    header('Content-Type: application/json; charset=utf-8');
    echo $response;
}