如何发送应用程序的数据,这是采取从后台邮件使用php邮件功能


How to send application form with data which is taken from backend to mail using php mail function

我的表单结构去邮件,但我的值是空白的。我的数据库值不会在引号中被替换。当我使用标签

时,如何在引号内写入它
   <?php
   $eid = $_SESSION['id1'];
    $select= "SELECT email from emp_details where id = '".$eid."' ";
    $result= mysql_query($select);
    $rows= mysql_fetch_array($result);
     $to= $rows['email'];
    /
    //$a=5;
     $subject = "Application form print";
     $message = "Warehousing Corporation Employees Welfare Fund Apllication form are as given below.<br>";
     $message .= "<br>"; 
     $message .= '<html><body>';
     $message .= "<div  style= 'border-style: solid; border-width: medium;margin: auto;padding: 10px;width: 1024px;'>
<h2 style='text-align:center;'> Warehousing Corporation Employees Welfare Fund  </h2>
<h2 style='text-align:center;'> Application form  </h2>
<br>Application Id :<b><?php echo $_SESSION["id1"]; ?></b>";
     $message .= "</body></html>";
     $message .= "<br>Regards,<br>";
     $message .= "Team| Welfare Fund.<br>";
     $message .= "Email- welfarefund.mswc@gmail.com | Web- www.welfarefundmswc.com<<br>";
     $message .= "Contact – 8408882561<br>";                                               
     $headers = "From: welfarefund.mswc@gmail.com" . "'r'n";
     $headers .= "MIME-Version: 1.0" . "'r'n";
     $headers .= "Content-type:text/html;charset=UTF-8" . "'r'n";
     mail($to,$subject,$message,$headers);       

?>

试试这个:

$to = $rows[0]['email'];,因为您正在使用mysql_fetch_array

并更改它,因为您正在使用PHP会话

$message .= "<div  style= 'border-style: solid; border-width: medium;margin: auto;padding: 10px;width: 1024px;'>
<h2 style='text-align:center;'> Warehousing Corporation Employees Welfare Fund  </h2>
<h2 style='text-align:center;'> Application form  </h2>
<br>Application Id :<b>". $_SESSION['id1']."</b>";