0

hi i am taking values from a page and getting values in second page whihch is working correctly but i have to send the values in url

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

//$errors = '';
$myemail = 'info@abcdef.com';//<-----Put Your email address here.
$to_go="abcdef@gmail.com";
    $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.";
?>

NOTE: This code will not work on localhost.

2 Answers2

1

Check out PHP's documentation on string interpolation

You want something like:

$email = "something@somewhere.com";
$body = "Your email address is: $email, hooray!";
echo $body;

Which will output Your email address is: something@somewhere.com, hooray!

Seventoes
  • 4,810
  • 3
  • 19
  • 19
  • my question is do not want to print anything in email i just want to pass out the values in link so the user when click on that link now it will show values in browser tab so i can take values using get – Muhammad Subhan Nov 01 '14 at 05:38
  • Yes, I understand that. You can place the parameters into your URL using the method I described. – Seventoes Nov 01 '14 at 05:42
0

Why you echo $email_address and where you initialize your email_address proper way to do like this

 $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";

and you can also send mail from localhost through smtp settings and put headers also before mail like this

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
Agha Umair Ahmed
  • 1,037
  • 7
  • 12