I am working on my new website, I am using a template but editing the contents with notepad++. I am currently editing the contact me page in which i am struggling to find a solution to sending the form data to a PHP script which will then send it as an email to me. I have created a PHP script that i think is ok to do the job but it is not working. After I submit some information into the text boxes then click submit it just redirects me to the PHP file in which looks to contain nothing. I have uploaded both the contact page and PHP file to my web server in which the same thing happens only now I will receive an email with none of the information I have entered only the "Hi my name is " stated within the PHP file. I am wondering if anybody knows what the issue is, I have spent majority of the day trying to work this out without luck. I will post both my HTML and PHP code below.
(p.s. I am aware that my "Reason for contact" part of the form will not send as I am still trying to work that one out.
Thanks in advance.
HTML
<form name="cForm" id="cForm" action="http://www.richardmotion.com/form-to-email.php" method="post">
<fieldset>
<div class="form-field">
<input name="cName" type="text" id="cName" class="full-width" placeholder="Your Name" value="">
</div>
<div class="form-field">
<input name="cEmail" type="text" id="cEmail" class="full-width" placeholder="Your Email" value="">
</div>
<div>
<label for="sampleRecipientInput">Reason For Contacting</label>
<div class="ss-custom-select">
<select class="full-width" id="sampleRecipientInput">
<option value="Option 3">General Enquiry</option>
<option value="Option 1">Question About A Guide</option>
<option value="Option 2">Question About A Review</option>
</select>
</div>
</div>
<div class="message form-field">
<textarea name="cMessage" id="cMessage" class="full-width" placeholder="Your Message"></textarea>
</div>
<button type="submit" name="submit" value="Submit" class="submit button-primary full-width-on-mobile">Submit</button>
</fieldset>
</form>
PHP
<?php
$cName = $_POST['name'];
$cEmail = $_POST['email'];
$cWebsite = $_POST['website'];
$cMessage = $_POST['message'];
?>
<?php
$email_from = '[email protected]';
$email_subject = "Website Enquiry";
$email_body = "Hi my name is $name,\n
\n
$message"
?>
<?php
$to = "[email protected]";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $cEmail \r\n";
mail($to,$email_subject,$email_body,$headers);
?>