Php流程表

时间:2014-08-13 14:14:00

标签: php

这是一个php格式流程的代码片段,我遇到了麻烦,我不确定如何在回复的电子邮件中显示电话号码('tel'):

$success = false;
$fname = isset( $_POST['fname'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['fname'] ) : "";
$sname = isset( $_POST['sname'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['sname'] ) : "";
$email = isset( $_POST['email'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['email'] ) : "";
**$tel = isset( $_POST['tel'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['tel']** ) : "";
$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";

// If all values exist, send the email
if ( $fname && $sname && $tel && $email && $message ) {
  $recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
  $headers = "From: " . $fname . " " . $sname . "  <" . $email . ">";
  $success = mail( $recipient, EMAIL_SUBJECT, $message, $headers );
}

非常感谢任何帮助。提前谢谢。

1 个答案:

答案 0 :(得分:0)

快速修复邮件中的电话号码只是将其附加到邮件变量中。

这样的事情:

$tel = isset( $_POST['tel'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['tel']** ) : "";
$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";

$message .= "Telephone: ".$tel;