I've created a HTML form with inputs named 'name' , 'email' , 'mobile' , 'message'.
Within my HTML i have used;
<form action='form_script.php' method='post'>
which will (when submitted) send to my form_script.php where my PHP should execute.
form_script.php
I have then created this php script which is supposed to get the the inputs from the form and send an email to 'enquiries@firelineband.co.uk'.
The problem is, the email is not being sent. I've checked through my PHP script numerous times and i can't seem to find any problem, which is why i have resulted in posted on here to have a second opinion.
if(isset($_POST['submit'])){
$to = "enquiries@firelineband"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$mobile = $_POST['mobile'];
$subject = $_POST['subject'];
$subject2 = "Copy of your form submission";
$message = "Name: " .$name . "\n\n mobile number: " . $mobile . ".\n\n Message:" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
Thanks in advance for your time. Sam
HTML Form
<table style='width:100%'>
<form action='form_script.php' method='post'>
<tr>
<th> <input type='text' required placeholder='Name' name='name' /> </th> <th> <input type='text' required placeholder='Email' name='email' /> </th>
</tr>
<tr>
<th> <input type='text' required placeholder='Mobile' name='mobile' /> </th> <th> <input type='text' required placeholder='Subject' name='subject' /> </th>
</tr>
<tr>
<th colspan='2'><textarea required placeholder='Message' name='message' ></textarea></th>
</tr>
<tr>
<th><input id='send_form' type='submit' /> </th>
</tr>
</form>
</table>