从在线表格向客户发送一份报告,告诉他所选择的所有数据?

我是这个领域的初学者 我已经为客户提供了一个提交表格来销售一些产品 我从客户输入的数据中获得从表格到我的电子邮件的消息.. 但我想客户获得相同的数据,他的依据是,客户在[电子邮件地址:]的字段中输入电子邮件地址,他的需求总价也电子邮件从在线表格向客户发送一份报告,告诉他所选择的所有数据?

我的PHP代码是:

<?php 

if(isset($_POST['email'])) {

$email_to = "HERE I PUT MY EMAIL";

$email_subject = "You've got a message - Online Form";

function died($error) {

echo "We are very sorry, but ";

echo $error."<br /><br />";

die();

}

// validation expected data exists

if(!isset($_POST['first_name']) ||

!isset($_POST['last_name']) ||

!isset($_POST['email']) ||

!isset($_POST['phone']) ||

!isset($_POST['face_cream']) ||

!isset($_POST['body_cream']) ||

!isset($_POST['body_oil']) ||

!isset($_POST['face_wash']) ||

!isset($_POST['breast_oil']) ||

!isset($_POST['comments'])) {

died('We are sorry, but there appears to be a problem with the form you submitted.');

}

$first_name = $_POST['first_name']; // required

$last_name = $_POST['last_name']; // required

$email_from = $_POST['email']; // required

$phone = $_POST['phone']; // required

$face_cream = $_POST['face_cream']; // not required

$body_cream = $_POST['body_cream']; // not required

$body_oil = $_POST['body_oil']; // not required

$face_wash = $_POST['face_wash']; // not required

$breast_oil = $_POST['breast_oil']; // not required

$comments = $_POST['comments']; // not required

$agreement = $_POST['agreement']; // required

$error_message = "";

$email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

if(!preg_match($email_exp,$email_from)) {

$error_message .= 'The Email Address you entered does not appear to be valid.<br />';

}

$string_exp = "/^[A-Za-z .'-]+$/";

if(!preg_match($string_exp,$first_name)) {

$error_message .= 'The First Name you entered does not appear to be valid.<br />';

}

if(!preg_match($string_exp,$last_name)) {

$error_message .= 'The Last Name you entered does not appear to be valid.<br />';

}

if(strlen($phone) < 6) {

$error_message .= 'The Phone Number you entered do not appear to be valid.<br />';

}

if(strlen($agreement) < yes) {

$error_message .= 'The agreement you entered do not appear to be valid.<br />';

}

if(strlen($error_message) > 0) {

died($error_message);

}

$email_message = "Form details below.\n\n";

function clean_string($string) {

$bad = array("content-type","bcc:","to:","cc:","href");

return str_replace($bad,"",$string);

}

$email_message .= "First Name: ".clean_string($first_name)."\n";

$email_message .= "Last Name: ".clean_string($last_name)."\n";

$email_message .= "Email: ".clean_string($email_from)."\n";

$email_message .= "Phone Number: ".clean_string($phone)."\n";

$email_message .= "The chosen quantity of (Face Cream) is: ".clean_string($face_cream)."\n";

$email_message .= "The chosen quantity of (Body Cream) is: ".clean_string($body_cream)."\n";

$email_message .= "The chosen quantity of (Body Oil) is: ".clean_string($body_oil)."\n";

$email_message .= "The chosen quantity of (Face Wash) is: ".clean_string($face_wash)."\n";

$email_message .= "The chosen quantity of (Breast Oil) is: ".clean_string($breast_oil)."\n";

$email_message .= "Comments: ".clean_string($comments)."\n";

// checkbox

if(isset($_POST['agreement']) &&

$_POST['agreement'] == 'yes')

{

echo "You've accepted our terms and conditions.<br>";

}

else

{

echo "You didn't agree on the Terms & Conditions.<br>";

}

// create email headers

$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

@mail($email_to, $email_subject, $email_message, $headers);

?>

<!-- include your own success html here -->

Thank you for contacting us. We will be in touch with you very soon.

<?php

}

?>

(提前致谢)

回答:

你只需要另一个@mail命令,扭转了EMAIL_FROM和EMAIL_TO

...... all your d**kload of code 

@mail($email_to, $email_subject, $email_message, $headers); // Sends to YOU

@mail($email_from, $email_subject, $email_message, $headers); // Sends to the client

你的问题的问题,为未来:

  1. 代码没有被写了,你(如果是,你应该已知道该怎么做)。
  2. 复制整个代码,因为(见第1期)
  3. 你并没有明确说明什么问题是

现在。如果这是你想要的。请点击“接受答案”打勾来帮助建立一些良好的业障

以上是 从在线表格向客户发送一份报告,告诉他所选择的所有数据? 的全部内容, 来源链接: utcz.com/qa/262049.html

回到顶部