我有一个简单的html表单。
<form name="cmxform" method="post" action="projecthandler.php" id="doxform">
<tr>
<td><input name="firstname" type="text" size="40"></font></td>
</tr>
<tr>
</tr>
<tr>
<td><input name="lastname" type="text" size="40"></td>
</tr>
</form>
projecthandler.php scrpit向用户发送电子邮件
<?php
if(isset($_POST['firstname'])) {
$email_to = "shruti15sargam@gmail.com";
$email_subject = "Project Subject";
$email_subject_user = "Confirmation";
$firstname = $_POST['firstname']; // required
$lastname = $_POST['lastname']; // required
$email_message = "Form details below.nn";
$email_message_user = "Thank you....";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($firstname)."n";
$email_message .= "Last Name: ".clean_string($lastname)."n";
// create email headers
$headers = 'From: '.$Email."rn".
'Reply-To: '.$email_from."rn" .
'X-Mailer: PHP/' . phpversion();
mail($Email, $email_subject_user, $email_message, 'From: donotreply@somemail.edu');
header('Location: thanks.html');
?>
<div>
echo "Hello World";
</div>
最后一个thanks.html页面需要将这些名字和姓氏值显示为表单数据。如何将此表单中的结果回显到确认(谢谢.html)页面。谢谢
您可以在网址www.mydomain.co.uk中发送值?value1=val&value2=val2
然后从那里获取数据(假设您对此安全性满意)。或者,就像已经提到的那样,你可以设置会话值:
即:
<?php
session_start();
$_SESSION['value1'] = $val;
$_SESSION['value2'] = $val2;
会话可能是进行tbh的方式。