I am building my portfolio website, and using a php script for the first time. I am hoping to achieve a simple email form using the following php code:
<?php
$to="myemail@gmail.com";
$subject="Website Contact Form Submission";
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
$headers=$_REQUEST['name'];
$Sent=mail($to,$subject,$message,$headers);
?>
When I hit the submit button, the email does actually send, and the 'to' and 'subject' fields seem to be working fine, however the email does not contain any of the information submitted in the fields using $_REQUEST
. Is there a syntax error or something? Why would only those 3 lines not work properly/at all? Be advised I am a novice coder, so there's a lot of stuff that is just plain over my head.
Not sure if this will help at all, but I basically followed this video as tutorial: https://www.youtube.com/watch?v=yW5cgqf6cNo&index=1&list=WL