我需要将用户从php表单发送到另一个表单,但我也需要传递一个URL查询。所以他们来到example.com/Form1.php$email=Whatever@Whatever.com,然后他们需要传递给example.com/Form2.php$email=Whatever@whatever.com。我无法在标题周围使用$ _GET('Location:http://www.example.com');
参见代码
<?php
$email = $_GET["email"];
$_POST['customerSatisfaction'];
$to = "blah";
$email_from = 'blah';
$email_subject = "blah";
$headers = "From: $email_from \r\n";
$email_body = " <?xml version = \"1.0\"?>
<?adf version = \"1.0\"?>
<adf>
<prospect>
<customer>
<email preferredcontact=\"1\">$email</email>
</customer>
</prospect>
</adf>
";
mail($to,$email_subject,$email_body,$headers);
header('Location: http://www.BLAH.com/NEED $EMAIL HERE!!');
?>
答案 0 :(得分:2)
您发布的内容无效。试试这个:
header('Location: http://www.BLAH.com/?email=' . urlencode($email));
此外,在发送重定向标头后添加exit;
通常也是一个好主意。