-1

Encountering a problem when trying to complete the contact form on my site, I'm finding error code 405 and not quite sure why. Whether it's a problem in my PHP or my HTML, can anybody help?

Site: https://loudburr.github.io/louisburr/ PHP:

    if (isset($POST['submit'])) {
$name = $POST['name'];
$subject = $POST['subject'];
$mailFrom = $POST['mail'];
$message = $POST['message'];

$mailTo = "*my email*";
$headers = "From: ". $mailFrom;
$txt = "You have received an e-mail from" .$name.".\n\n".$message;

mail($mailTo, $subject, $txt, $headers); 
header("Location: index.html?mailsend");'

Any help would be great!

Cheers!

1 Answers1

0

405 means "method not allowed". You are making a POST request and the server is telling you that you aren't allowed to make POST requests to that URL.

It isn't a PHP or HTML problem.

Your hosting service (Github pages) doesn't support any server-side programming features, so it doesn't support POST requests (or PHP).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Hey Quentin, thanks for reaching out. I was not aware of this, do you know how I may be able to get this contact form to function under Github or know an alternative method to getting my website hosted and have the PHP working? – Loudburr Jun 30 '20 at 17:41
  • "do you know how I may be able to get this contact form to function under Github" — Github. Does. Not. Support. Any. Server-side. Programming. Features. – Quentin Jun 30 '20 at 21:01
  • "know an alternative method to getting my website hosted and have the PHP working?" — Use a hosting service with the features you need. – Quentin Jun 30 '20 at 21:01