How to fix the HTTP error 405 when trying to run connect.php using vs code?

I’m trying to create a registration form that stores all the new data entered by users into a database using xampp phpmyadmin but every time I try to submit the form by clicking on the register button, it returns this error: “This page isn’t working. If the problem continues contact the site owner. HTTP error 405“. I’m on a mac btw.

This is my HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sign Up - Bloom of Psyche</title>
  <link rel="stylesheet" type="text/css" href="register-form.css">

</head>
<body>
  <section>
    <div class="formbox">
      <div class="form-value">
        <form method="post" action="connect.php">
          <h2>SIGN UP</h2>
          <div class="inputbox">
            <input type="text" id="first_name" name="firstName" required>
            <label for="">First Name</label>
          </div>
          <div class="inputbox">
            <input type="text" id="last_name" name="lastName" required>
            <label for="">Last Name</label>
          </div>
          <div class="inputbox">
            <input type="email" id="email_address" name="email" required>
            <label for="">Email</label>
          </div>
          <div class="inputbox">
            <input type="password" id="user_password" name="password" required>
            <label for="">Password</label>
          </div>
          <button>Register</button>
          <div class="login">
            <p>Already have an account? <a href="login-form.html">Log in</a></p>
          </div>
        </form>
      </div>
    </div>
  </section>
  <script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
  <script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
</body>
</html>

and this is my PHP code:

<?php
    $firstName = $_POST['firstName'];
    $lastName = $_POST['lastName'];
    $email = $_POST['email'];
    $password = $_POST['password'];

    $conn = new mysqli('localhost', 'root', '', 'bloomofpsyche_database');
    if($conn->connect_error){
        die('Connection Failed : '.$conn->connect_error);
    }else{
        $stmt = $conn->prepare("insert into registration(firstName, lastName, email, password) values(?, ?, ?, ?)");
        $stmt->bind_param("ssss", $firstName, $lastName, $email, $password);
        $stmt->execute();
        echo "You have successfully registered!";
        $stmt->close();
        $conn->close();
    }
?>