【发布时间】:2015-10-19 10:43:36
【问题描述】:
我希望提交显示在重定向页面上的表单数据,并通过电子邮件发送给用户和我自己。我已经让电子邮件部分开始工作,现在我正在尝试找出重定向到单独页面并显示提交内容的最佳方式。
<?php
$emailSubject = 'MFPT Submission';
$webMaster = 'todd@treble-one.com';
$Email = $_POST['Email'];
$FirstName = $_REQUEST['FirstName'];
$LastName = $_REQUEST['LastName'];
$organization = $_REQUEST['organization'];
$AddressLine1 = $_REQUEST['AddressLine1'];
$AddressLine2 = $_REQUEST['AddressLine2'];
$City = $_REQUEST['City'];
$StateProvince = $_REQUEST['StateProvince'];
$Country = $_REQUEST['Country'];
$ZipPostalCode = $_REQUEST['ZipPostalCode'];
$Telephone = $_REQUEST['Telephone'];
$Title = $_REQUEST['Title'];
$WrittenPaper = $_REQUEST['WrittenPaper'];
$Suggested_Conference_Session = $_REQUEST['Suggested_Conference_Session'];
$Suggested_Conference_Track_Other = $_REQUEST['Suggested_Conference_Track_Other'];
$CoAuthor = $_REQUEST['CoAuthor'];
$Abstract = $_REQUEST['Abstract'];
$body = <<<EOD
Email: $Email
FirstName: $FirstName
LastName: $LastName
organization: $organization
AddressLine1: $AddressLine1
AddressLine2: $AddressLine2
City: $City
StateProvince: $StateProvince
Country: $Country
ZipPostalCode: $ZipPostalCode
Telephone: $Telephone
Title: $Title
WrittenPaper: $WrittenPaper
Suggested_Conference_Session: $Suggested_Conference_Session
Suggested_Conference_Track_Other: $Suggested_Conference_Track_Other
CoAuthor: $CoAuthor
Abstract: $Abstract
Comments: $Comments
EOD;
$host = "mail.treble-one.com";
$username = "todd@treble-one.com";
$password = "*******";
$headers = 'From: Your name <mfpt@mfpt.com>' . "\r\n";
$headers .= "Content=type: text/html\r\n";
$headers .= "CC: $Email\r\n";
$success = mail ($webMaster, $emailSubject, $body,$headers);
echo $body;
?>
感谢您的任何建议。
【问题讨论】:
-
header('Location: ...')? -
这是“最佳方式”@MarcB 吗? ;-)
-
好吧,“最好的方式”是一种观点,观点是题外话,所以......
-
你不是已经得到你想要显示的结果了吗?重定向的意义何在?
-
对,我想重定向以使内容出现在我的网站模板中,而不是像现在这样回显到白屏。也许有比重定向更简单的方法?
标签: php redirect submit echo form-submit