Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Kevin Dunn
Kevin Dunn
6,623 Points

Problems with sending data through HTML forms

Hi, I tried to create a Contact form that would send an email with php but everytime I press the Send button, I get an error message saying 405 Not Allowed. I am running the page on Github and the protocol is HTTPS. Could that be the reason why? Hope someone has an idea why im getting such an error.

<?php

$userName = $_POST['userName'];
$userEmail = $_POST['userEmail']; 
$userMessage = $_POST['userMessage']; 

$to = "myemail@mail.com";
$subject = "New Message";

mail ($to, $subject, $userMessage, "From: " . $userName);
echo "Your message has been sent"; 
?>

1 Answer

Github Pages only support static content so they don't allow PHP code.

Kevin Dunn
Kevin Dunn
6,623 Points

Ahh thats too bad...but thanks alot!