I don’t know what to do as to why it is missing or not redirecting to a success page after sending.
<script type="text/javascript">
(function($,W,D)
{
var LOGICSART = {};
LOGICSART.UTIL =
{
setupFormValidation: function()
{
//form validation rules
$("#register-form").validate({
rules: {
name: "required",
phone: "required",
subject: "required",
comments: "required",
email: {
required: true,
email: true
},
},
messages: {
firstname: "Please enter your name",
phone: "Please enter Phone number",
comments: "Please comment or ask a question",
subject: "Please select a subject",
email: "Please enter a valid email address"
},
submitHandler: function(form) {
form.submit();
}
});
}
}
//when the dom has loaded setup form validation rules
$(D).ready(function($) {
LOGICSART.UTIL.setupFormValidation();
});
})(jQuery, window, document);
</script>
</head>
<body>
<?php
$name = '';
$phone = '';
$email = '';
$subject = '';
$comments = '';
if(isset($_POST['subm'])) {
$error = array();
$data = array();
include "datafunction.php";
/*Please modify variable values according to requirement*/
$min = 3; //Min length of string
$max = 20; // Max length of string
$maxc = 300; // Max length of string
$receiverEmail = 'luck@bluebird.com'; //Set Email Receiver Email address
$receiverName = 'Joe'; //Set Email Receiver name
$FromEmail =''; //Set From Email
$FromName = ''; //Set From name
$mailSubject = 'Mail for website'; //Set Email subject
/*End*/
foreach($_POST as $key=>$val)
{
if($key=='name')
{
if(validBlank($val) == 1)
{
$error[] = "Name cannot blank";
}
$checkLength = validStrLen($val,$min,$max);
if($checkLength!=1)
{
if($checkLength == 'short') {
$error[] = "Name is too short, minimum is ".$min." characters (".$min.", ".$max.")";
} else {
$error[] = "Name is too long, maximum is ".$max." characters (".$min.", ".$max.")";
}
}
$name = fnSanitizeStringr($val);
}
if($key=='phone')
{
if(validBlank($val) == 1)
{
$error[] = "Phone number cannot blank";
}
$validation = new PhoneValidation();
$isvalidPhone = $validation->validate('phone',$val);
if($isvalidPhone != 1)
{
$error[] = 'Phone number is not in valid US Format';
}
$phone = $val;
}
if($key=='email')
{
if(validBlank($val) == 1)
{
$error[] = "Email address cannot blank";
}
$val = fnSanitizeEmaill($val);
$test = new EmailValdation;
$test->email = $val;
if($test->checkEmailDomain() == 0) { //Check DNS of Email Address
$error[] = 'Invalid email address';
}
$email = $val;
}
if($key=='comments')
{
if(validBlank($val) == 1)
{
$error[] = "Comments cannot blank";
}
echo $checkLength = validStrLen($val,$min,$maxc);
if($checkLength!=1)
{
if($checkLength == 'short') {
$error[] = "Comments field is too short, minimum is ".$min." characters (".$min.", ".$max.")";
} else {
$error[] = "Comments field is too long, maximum is ".$maxc." characters (".$min.", ".$max.")";
}
}
$comments = fnSanitizeStringr($val);
}
$data[$key] = _clean($val);
}
if(count($error) > 0)
{
echo '<div class="error"><ul>';
foreach($error as $er)
{
echo '<li>'.$er.'</li>';
}
echo '</ul></div>';
}
else {
$msg = "<table><tr><td>Name:</td><td>".$data['name']."</td></tr>
<tr><td>Phone:</td><td>".$data['phone']."</td></tr>
<tr><td>Email:</td><td>".$data['email']."</td></tr>
<tr><td>Subject:</td><td>".$data['subject']."</td></tr>
<tr><td>Comments:</td><td>".$data['comments']."</td></tr></table>";
require 'mailer/PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom($FromEmail,$FromName);
//Set who the message is to be sent to
$mail->addAddress($receiverEmail,$receiverName);
//Set the subject line
$mail->Subject = $mailSubject;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($msg);
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header("Location: thank_you.php");
}
}
} ?>
1.) I have tried it as thank_you/
http://www.domain.com/thank_you/
in the } else {
header(“Location:…” no good.
1a.) I really don’t want to use: " else { echo ‘Message has been sent.’; }"
the site displays as www.domain.com/thank_you/
2.) I want to send back to the sender what they submitted to
3.) also, it shows constantly as "Root User <root@localhost> " instead of the sender’s own email address in the mail inbox.
How do I change that?
Thanks