AJAX mistake make 500 error after insert to database table [duplicate]

im newbie, i have 500 error, when i wanna send new information in DB.

<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible">
    <title>WEB ID</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,[email protected],100..900&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="change-light">
    <button>Press to <span>Light</span></button>
</div>
<div class="form-block light">
    <div class="header">
        <h1>Создание WEB ID</h1>
        <div class="desc-block">
            <div class="desc">Уже есть WEB ID?</div>
            <a href="#">Найти его здесь ></a>
        </div>
    </div>
    <form>
        <div class="block">
            <input type="text" id="name" placeholder="Имя">
        </div>
        <div class="block">
            <input type="text" id="surname" placeholder="Фамилия">
        </div>
        <div class="hr"></div>
        <div class="block">
            <input type="text" id="dateofbirth" placeholder="Дата рождения">
        </div>
        <div class="block">
            <select name="country" id="country">
                <option value="">Страна</option>
                <option value="Russia">Россия</option>
                <option value="Canada">Канада</option>
            </select>
        </div>
        <div class="block">
            <input type="text" id="email" placeholder="Почта">
        </div>
        <div class="hr"></div>
        <div class="block">
            <input type="password" id="password" placeholder="Пароль">
        </div>
        <div class="block">
            <input type="password" id="repeat_password" placeholder="Повторите пароль">
        </div>
        <div class="errors-block">
            <p></p>
        </div>
        <input type="submit" value="Продолжить">
    </form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="main.js"></script>
</body>
</html>
$('document').ready(function () {
    let register_form = $('.form-block form');
    register_form.on('submit', function (event) {
        event.preventDefault();
        let name = $('#name').val();
        let surname = $('#surname').val();
        let dateofbirth = $('#dateofbirth').val();
        let country = $('#country').val();
        let email = $('#email').val();
        let password = $('#password').val();
        let repeat_password = $('#repeat_password').val();
        let email_mask = /^[w-.]+@[w-]+.[a-z]{2,4}$/i;
        let date_mask = /d{1,2}/d{1,2}/d{2,4}/;

        let noErrors = true;

        $('.error').remove();
        $('.errored').removeClass('errored');

        if (name.length < 1) {
            $('#name').parent().addClass('errored');
            $('#name').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }
        if (surname.length < 1) {
            $('#surname').parent().addClass('errored');
            $('#surname').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }
        if (dateofbirth.length < 1 || !date_mask.test(dateofbirth)) {
            $('#dateofbirth').parent().addClass('errored');
            $('#dateofbirth').after('<div class="error"><span>Заполните это поле в формате **/**/****</span></div>');
            noErrors = false;
        }
        if (country.length < 1) {
            $('#country').parent().addClass('errored');
            $('#country').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }
        if (email.length < 1 || !email_mask.test(email)) {
            $('#email').parent().addClass('errored');
            $('#email').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }
        if (password.length < 1) {
            $('#password').parent().addClass('errored');
            $('#password').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }
        if (repeat_password.length < 1 || password !== repeat_password) {
            $('#repeat_password').parent().addClass('errored');
            $('#repeat_password').after('<div class="error"><span>Заполните это поле</span></div>');
            noErrors = false;
        }

        if (noErrors) {
            $.ajax({
                url: 'new_registration.php',
                method: 'POST',
                dataType: 'html',
                data: {
                    "name": name,
                    "surname": surname,
                    "dateofbirth": dateofbirth,
                    "country": country,
                    "email": email,
                    "password": password,
                    "repeat_password": repeat_password
                },
                success: function (data) {
                    console.log('DONE');
                    register_form.trigger('reset');
<?php
$servename = "localhost";
$user = "anar";
$password = "anar";
$database = "webid";

$connection = mysqli_connect($servename,$user,$password,$database);
mysqli_set_charset($connection, "utf8");
if($connection->connect_error){
    die("Ошибка подключения: " . $connection->connect_error);
}
<?php
include 'config.php';

$msg_box = "";
$errors = array();

$name = $_POST['name'];
$surname = $_POST['surname'];
$dateofbirth = $_POST['dateofbirth'];
$country = $_POST['country'];
$email = $_POST['email'];

if ($name = "") $errors[] = "Поле имени не заполнено";
if ($surname = "") $errors[] = "Поле фамилии не заполнено";
if ($dateofbirth = "") $errors[] = "Поле даты не заполнено";
if ($country = "") $errors[] = "Поле страны не заполнено";
if (($email == "") || (filter_var($email, FILTER_VALIDATE_EMAIL) == false)) {
    $errors[] = "Поле email не заполнено!";
}

if ($password = "") $errors[] = "Поле пароля не заполнено";
if ($repeat_password = "") $errors[] = "Поле повтора пароля не заполнено";
if ($password !== $repeat_password) {
    $errors[] = "Пароли не совпадают";
} else {
    $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
}

if (empty($errors)) {
    $stmt = mysqli_prepare($connection, "INSERT INTO users (name, surname, dateofbirth, country, email, password) VALUES (?, ?, ?, ?, ?, ?)");

    mysqli_stmt_bind_param($stmt, "ssssss", $name, $surname, $dateofbirth, $country, $email, $password);

    mysqli_stmt_execute($stmt);
} else {
    echo "есть ошибка";
}


$connection->close();

When i make select * from users – it works right. i wanna create a new user in users via registration form.
console saying Failed to load resource: the server responded with a status of 500 (Internal Server Error) i have problem here:

try {
    r.send(i.hasContent && i.data || null)
} catch (e) {
    if (o)
        throw e
}