2014-11-01 51 views
0

你好我从页面取值并获得在第二页whihch工作正常价值,但我必须在URL值发送要在URL发送会话值

<?php 
     session_start(); 
     $_SESSION["email_address"] = $_REQUEST["email_address"]; 
    echo "Favorite color is " . $_SESSION["email_address"] . ".<br>"; 

//$errors = ''; 
$myemail = '[email protected]';//<-----Put Your email address here. 
$to_go="[email protected]"; 
    $to = $to_go; 
    $email_subject = "Contact form submission: aaname"; 
    $email_body = "You have received a new message. ". 
    " Here are the details: Kindly  <a href='localhost/ci/email_wait.php?email_address='.echo $email_address.'&password'=.$password.'> 
    Click Here</a> to reset your password"; 

    $headers = "From:". $myemail; 
    $headers .= "Reply-To: $email_address"; 

    mail($to,$email_subject,$email_body,$headers); 
    //redirect to the 'thank you' page 
    echo "Mail Sent. Thank you we will contact you shortly."; 
?> 

注:此代码将不会在本地主机上工作。

回答

0

为什么你回声$ EMAIL_ADDRESS并在您初始化EMAIL_ADDRESS正确的方式做这样的

$email_body = "You have received a new message. Here are the details: Kindly<a href='localhost/ci/email_wait.php?email_address='".$email_address."'&password='".$password."'>Click Here</a> to reset your password"; 

,你也可以从本地主机通过SMTP设置发送邮件,并把标题也喜欢邮件之前这

$headers = "MIME-Version: 1.0" . "\r\n"; 
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 
+0

请注意,您应该进行urlencode你放到一个URL – 2014-11-01 05:38:38

+0

@Agha你的代码是打印在电子邮件的一切,我不希望你的代码的任何内容输出是您收到一条新消息。 **以下是详细信息:请 ** – 2014-11-01 05:41:37

+0

非常感谢你 – 2014-11-01 05:53:49

1

退房PHP对string interpolation

012文件

你想要的东西,如:

$email = "[email protected]"; 
$body = "Your email address is: $email, hooray!"; 
echo $body; 

将输出Your email address is: [email protected], hooray!

+0

我的问题是不想在电子邮件中打印任何内容我只想传递链接中的值,所以用户点击该链接时,它会显示浏览器选项卡中的值,所以我可以使用获取值 – 2014-11-01 05:38:42

+0

是的,我明白这一点。您可以使用我描述的方法将参数放到您的URL中。 – Seventoes 2014-11-01 05:42:45