PHP : sending reset password link in email

i am sending password reset link using html email in php . this is structure of m code . First is html email

<?php $bodymessage= '<table border="0" cellpadding="0" cellspacing="0" width="100%" >;
 $bodoymessaage= .='<a href="$link"' .....?>

the i've setup heaeders

 <?php $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 ?>

and after this i recieve form fields and mail function like this

if($passreset){
       mail($to, $subject, $bodymessage, $headers);
} 

now problem is that I've to get reset link and place it in html template thats being set in query and that comes after html template and headers , my questions is what should be order of template , headers and form query that i may get reset link in html template here $bodoymessaage= .='<a href="$link"' .....?>


Click here view more answers http://ift.tt/1Jff7iU