I'm currently trying to create a very basic PHP script which gets the content from a html form, stores them as variables and then sends an email containing said information.
After implementing this, all seems to be working apart from the actual message information.
My HTML reads:
<table style="width:100%">
<form action="form_complete.php" method="POST">
<tr>
<th> <input type="text" name="name" required placeholder="Name" /> </th>
<th> <input type="text" name="email" required placeholder="Email" /> </th>
</tr>
<tr>
<th> <input type="text" name="mobile" required placeholder="Mobile" /> </th>
<th> <input type="text" name="subject" required placeholder="Email Subject" /> </th>
</tr>
<tr>
<th colspan="2"> <textarea name="message" required placeholder="Enter your message"></textarea> </th>
<tr>
<th> </th>
<th> <input id="submit" type="submit" name="submit" value="Send" /> </th>
</tr>
and the relevant PHP reads:
if(isset($_POST['submit'])){
$to = "example@123.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$mobile = $_POST['mobile'];
$subject = $_POST['subject'];
$getMessage = $_POST['message'];
$subject2 = "Receipt of email submission";
$message = "You have received a new email from " . $name . ". \n Message: " . $getMessage;
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2);
Like I said, when I check the content of the email, the name parses fine, as does the mobile number and subject, but the content of the message doesn't seem to and I have no idea why.