I'm trying to have my submit button send name, email and message to my desired address. When I hit send, i get a page that says "This page isn't working - HTTP error 405." Some notes: I'm using visual studio code and using their live server extension to test it. I have script tags in HTML linking it to my php file (not sure if this matters as it's already linked under form element?) The "contact.php" is my php file. I'm a noobie so I'm hoping I'm making a simple mistake.
// MY PHP
<?php
$userName = $_POST['name'];
$userEmail= $_POST['email'];
$message= $_POST['message'];
$to = "stackoverflowexample@gmail.com";
$body = "";
$body .= "From: ".$userName. "\r\n";
$body .= "Email: ".$userEmail. "\r\n";
$body .= "Message: ".$message. "\r\n";
mail($to,$body);
?>
// MY HTML
<form action="contact.php" method="POST">
<h2>Send Message</h2>
<div class="inputbox">
<input type="text" name="name" required="required">
<span>Full Name</span>
</div>
<div class="inputbox">
<input type="text" name="email" required="required">
<span>Email</span>
</div>
<div class="inputbox">
<textarea required="required" name="message"></textarea>
<span>Type your Message...</span>
</div>
<div class="inputbox">
<input type="submit" name="" value="Send">
</div>
</form>