Hey all
Sorry for becoming a new member and then pasting this but I've started a new job in I.T and I've been asked to work on the company website even though I have no idea about PHP/HTML so I need to become a fast learner! Any help will be muchly appreciated.
Basically on the contact us form on the website, a PHP script emails us the form which works fine except it misses out two lines which is should have filled in? I cannot see any errors and dreamweaver reports that the syntax is all good.
Would somebody mind taking a look at the coding and see if you can spot anything wrong?
HTML FORM
<h1>Contact Us</h1>
<p>Please fill out the following form to contact us.</p>
<form id="contactform" method="post" action="contactengine.php">
<p>
<label for="Name" >Your Name:</label>
<br />
<input type="text" name="Name" id="Name" class="inputValue"/>
<span class="required">*required</span><br />
<br />
<label for="Email" >Company Name:</label>
<br />
<input type="text" name="Company Name" id="Company" class="inputValue"/>
<span class="required">*required</span><br />
<br />
<label for="Email" >Phone Number:</label>
<br />
<input type="text" name="Phone Number" id="Phone" class="inputValue"/>
<span class="required">*required</span><br />
<br />
<label for="Email" >Your Email:</label>
<br />
<input type="text" name="Email" id="Email" class="inputValue" />
<span class="required">*required</span><br />
</p>
<br />
<label for="Comments" >Your Message:</label>
<br />
<textarea name="Comments" cols="45" rows="8" class="inputText" id="Comments" ></textarea>
<br />
<br />
<input type="submit" value="Submit" class="inputButton"/>
</p>
</form>
PHP SCRIPT
<?php
//Email Details
$EmailFrom = "someone@nowhere.com";
$EmailTo = "someone@nowhere.com";
$Subject = "Website Contact Form Submission";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Comments = Trim(stripslashes($_POST['Comments']));
// prepare email body text
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company Name: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Phone Number: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Comments;
$Body .= "\n";
// send email
$success = mail($EmailTo,$Subject,$Body, "From: <$EmailFrom>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
Email Arrives like this:
Name: test
Company Name:
Phone Number:
Email: test@test.com
Message: sdfdsfs
Basically the email arrives as shown but it's missing the Phone Number and Company name details? I think this code has been borrowed when the website made so it's been changed to suite our needs.
Thanks for taking the time to look at this!