Hello,
Look At the Following Code Below ::
PHP Code:
<?php
// ------- three variables you MUST change below -------------------------------------------------------
$valid_ref1="http://www.your-domain.com";// change "Your--domain" to your domain
$valid_ref2="http://www.your-domain.com";// change "Your--domain" to your domain
$replyemail="your email@your domain.com";//change to your email address
// ------------------------------------------------------------
//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
return preg_replace($patterns, "", strtolower($value));
}
$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$thetitle = clean_input_4email($_POST["thetitle"]);
$thekeywords = clean_input_4email($_POST["thekeywords"]);
$themessage = clean_input_4email($_POST["themessage"], false);
$error_msg='ERROR - not sent. Try again.';
$success_sent_msg='<p align="center"><strong> </strong></p>
<p align="center"><strong>Your request has been successfully sent to us<br>
</strong> and we will reply as soon as possible.</p>
<p align="center">A copy of your query has been sent to you.</p>
<p align="center">Thank you.</p>';
$replymessage = "Hi $name
Thank you for your email.
We will endeavour to responsed to your submission request shortly.
Please DO NOT reply to this email.
Below is a copy of the request you submitted:
--------------------------------------------------
$thesubject
$thetitle
$themessage
--------------------------------------------------
Thank you";
// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "name: $name \nQuery: $themessage";
mail("$replyemail",
"$thesubject",
"$themessage",
"$thetitle",
// "$thekeywords",
"From: $email\nReply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
?>
In the above code, I am having a few problems.
1. When I submit the form using this PHP, the reply Email address does not get any Email regarding the Order details, But a copy of Order has been sent to The Applicant.
Code:
$replyemail="your email@your domain.com";//change to your email address
The Email Address, that was specified in the above area, did not get Details of the order, But the Applicant(of the order) got a receipt of his order.
2. On Clicking Submit Button, In Contact Form, I want the Details Sent to Admin Email($replyemail) and simultaneously, redirected to Paypal Payment Page.
I would be greatful to anyone who helps me and provides me the corrected PHP code, with corrections I mentioned.
Thanks