Is there a way i can solve Error 405 after trying to connect php to mySQL?

I experienced error 405 after trying to connect php with mySQL database.Below is my code snippet;

`<?php
$mysqli = new mysqli('localhost', 'root', 'password', 'dexnetworks');
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$userName = $_POST['userName'];
$phoneNumber = $_POST['phoneNumber'];
$email = $_POST['email'];
$password = $_POST['password'];

$stmt = $conn->prepare("INSERT INTO register (userName, phoneNumber, email, password) VALUES (?, ?, ?,   ?)");
$stmt->bind_param("ssss", $userName, $phoneNumber, $email, $password);

if ($stmt->execute() === TRUE) {
    echo "Record added successfully";
} else {
    echo "Error: " . $conn->error;
}

$stmt->close();
}
$conn->close();
?>`

I wrote a php code for connecting database to my website where my registartion tab is register.html ,afterwards i tried registering a new user expecting the registration to be successful i was redirected to Error 405 page.