I'm pretty new with php coding. Recently, I made a code with html and decided to make a php code so that it can deliver messages online. But when I uploaded it to the server, the code brings this error. This is the code that I wrote in php
<?php
$name= $_POST['name'];
$email=$_POST['email'];
$number=$_POST['number'];
$enquiry=$_POST['enquiry'];
$reaction=$_POST['reaction'];
$cpreference=$_POST['cpreference'];
$comment=$_POST['comment'];
$to = 'repoductivehealthservices@gmail.com';
$subject = 'New Get-In-Touch Form Recieved';
$message = "Name: ".$name."\nEmail: ".$email."\nPhone Number: ".$number."\nType of Enquiry: ".$enquiry."\nContact Back: ".$reaction."\nContact Preference: ".$cpreference."\nComments: ".$comment;
$headers = 'From: getintouch@reproductivehealthservices.com' . "\r\n" .
'Reply-To: no_reply@reproductivehealthservices.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
<script>
alert('Thanks! We will get back to you soon.');
window.location.replace("../get-in-touch/index.html");
</script>
and this is the error that I got when i filled in the text-field in the website.
[06-May-2018 05:37:47 UTC] PHP Parse error: syntax error, unexpected ''X-Mailer'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /home/reproduc/public_html/get-in-touch/redirect.php on line 16
[06-May-2018 05:38:29 UTC] PHP Warning: mail() expects parameter 4 to be string, array given in /home/reproduc/public_html/get-in-touch/redirect.php on line 18
[06-May-2018 05:41:36 UTC] PHP Warning: mail() expects parameter 4 to be string, array given in /home/reproduc/public_html/get-in-touch/redirect.php on line 18
[06-May-2018 05:42:06 UTC] PHP Warning: mail() expects parameter 4 to be string, array given in /home/reproduc/public_html/get-in-touch/redirect.php on line 18
[06-May-2018 05:55:01 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/reproduc/public_html/get-in-touch/redirect.php:23) in /home/reproduc/public_html/get-in-touch/redirect.php on line 25
You can download the html file from here https://drive.google.com/file/d/1v1q-IgLxKq0hwCPbLyNU7aEwHqVc_-IL/view?usp=sharing