I have been trying to build my own website and a central part of it is a form. I have set up an email address to recieve form results. I have been able to run the website on localhost and everything but the forms are working. When I click submit, it sucsessfully sends me to the PHP file and I am not recieving any emails from the file. I have checked my spam and it is empty. I am brand new to PHP and I tried to adapt some code I found online. I am not sure if there is anything wrong with my code or not. If anyone could help that would be great. I am also trying to be able to send an image file through the form. This is a screenshot of what the server log says when I try to submit the form. Server Log Screenshot This is the code I have wrote:
<?php
$title = htmlspecialchars($_POST['title']);
$coordinates = htmlspecialchars($_POST['coordinates']);
$description = htmlspecialchars($_POST['description']);
$shelterorcampsite = htmlspecialchars($_POST['shelter-campsite']);
$distanceToWater = htmlspecialchars($_POST['howfarawayiswater']);
$image = $_POST['file'];
$email_from = 'contactbackpackingproject@gmail.com';
$email_subject = "New Form submission";
$email_body = "There has been a new campsite submission.
The title is: $title;
The type is: $shelterorcampsite;
The coordinates are: $coordinates;
The description is: $description;
The distance to water is: $distanceToWater;
An image is: $image";
$to = 'contactbackpackingproject@gmail.com';
mail($to,$email_subject,$email_body,$headers);
?>
This is a screenshot of the code is VS code: VS code screenshot