Padraic Hosting
Member
What error is it giving?
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Ok Ive done the following,
Code on site.
<form> - delete this tag
<form method="post" action="contactengine.php">
<form> - remove
<form method="post" action="contactengine.php">
<input type="text" class="col-md-6 col-xs-12 name" name='name' placeholder='Name'/> - change to 'Name' - to match the php POST
<input type="text" class="col-md-6 col-xs-12 Email" name='Email' placeholder='Email'/>
<input type="text" class="col-md-6 col-xs-12 Tel" name='Tel' placeholder='Phone Number'/> - Add this line for telephone number, as per $_POST['Tel'] ?
<input type="text" class="col-md-12 col-xs-12 Subject" name='Subject' placeholder='Subject'/>
<textarea type="text" class="col-md-12 col-xs-12 Message" name='Message' placeholder='Message'></textarea>
<div class="cBtn col-xs-12">
<ul>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</ul>
</div>
</form>
// prepare email body text - a few changes to your prepare email section
$header = 'A client has filled out the contact form, see details below' . "\n" . '---------------------------------------------------' . "\n";
$dets = 'Name: ' . $Name . "\n";
$dets1 = 'Telephone number: ' . $Tel . "\n";
$dets2 = 'Email Address: ' . $Email. "\n";
$dets3 = 'Subject: ' . $Subject . "\n";
$dets4 = 'Message: ' . $Message . "\n";
$messagey = $header . $dets . $dets1 . $dets2 . $dets3 . $dets4;
//Changes the reply to email so the you can easily reply
$headers = 'From: ' . $_POST["Email"] . "\r\n" .
'Reply-To: ' . $_POST["Email"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// send email
$success = mail("$EmailTo", "$Subject", $messagey, "$headers");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
<?php
if ((isset($_POST['Name'])) && (strlen(trim($_POST['Name'])) > 0)) {
$Name = stripslashes(strip_tags($_POST['Name']));
} else {$Name = 'No name entered';}
if ((isset($_POST['Tel'])) && (strlen(trim($_POST['Tel'])) > 0)) {
$Tel = stripslashes(strip_tags($_POST['Tel']));
} else {$Tel = 'No Phone Number Entered';}
if ((isset($_POST['Email'])) && (strlen(trim($_POST['Email'])) > 0)) {
$Email = stripslashes(strip_tags($_POST['Email']));
} else {$Email = 'No e-Mail Address Entered';}
if ((isset($_POST['Subject'])) && (strlen(trim($_POST['Subject'])) > 0)) {
$Subject = stripslashes(strip_tags($_POST['Subject']));
} else {$Subject = 'No Subject Entered';}
if ((isset($_POST['Message'])) && (strlen(trim($_POST['Message'])) > 0)) {
$Message = stripslashes(strip_tags($_POST['Message']));
} else {$Message = 'No Message Entered';}
ob_start();
?>
<b>Name</b>:
<?=$Name;?>
<br><br>
<b>Telephone</b>:
<?=$Tel;?>
<br><br>
<b>E-mail</b>:
<?=$Email;?>
<br><br>
<b>Subject</b>:
<?=$Subject;?>
<br><br>
<b>Message</b>:
<?=$Message;?>
<br><br>
<?
$body = ob_get_contents();
$to = '[email protected]';
$email = '[email protected]';
$fromaddress = "[email protected]";
$fromname = "[B]YOUR FROM NAME[/B]";
require("phpmailer.php");
$mail = new PHPMailer();
$mail->From = "[email protected]";
$mail->FromName = "[B]YOUR FROM TITLE[/B]";
$mail->AddAddress("[B]YOUR EMAIL ADDRESS[/B]","Your Name "); //change to your email address
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "[B]YOUR SUBJECT[/B]";
$mail->Body = $body;
$mail->AltBody = $body;
if(!$mail->Send()) {
$recipient = '[B]YOUR EMAIL ADDRESS[/B]'; //change to your email address
$subject = 'Contact form failed';
$content = $body;
mail($recipient, $subject, $content, "From: [email][email protected][/email]\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
exit;
}
?>