Javascript Fetch POST Request is showing up as a GET request on my backend (and stopping anything from working)

This is my post request. It is used to send the data of the user to a backend php page. I did some debugging and

    const fullusername = "<?php echo $to; ?>";
    const personontheline = sessionStorage.getItem('name');
    fetch('inc/AI2.php', {
        

    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    body: new URLSearchParams({
        fullname: fullusername, //variable
        personwhoclicked: personontheline //variable
    }) //continues to fetch errors

This is the backend. It shows that the $_SERVER['REQUEST_METHOD'] is a GET request for some reason. I’m not really good at php or javascript. It doesn’t work at all for some reason and i’ve spent hours trying to troubleshoot it. Its probably something dumb lol.

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    //do stuff
    }
} else {
    // Handle invalid requests
    echo "Invalid request       ".$_SERVER['REQUEST_METHOD'];
    die();
}

I tried switching the method of the fetch to a GET method, but this slightly fixed the code as my code does not recognize the GET method’s variables

if (isset($_GET['fullname']) AND isset($_GET['personwhoclicked'])) { //work } 
else{ echo "error"; }   

This is what burp suite makes it look like with post requests

This is what burp suite makes it look like with GET requests