如何使用php邮件功能发送包含从后端到邮件的数据的申请表

时间:2015-08-13 08:46:11

标签: php html

我的表单结构转到邮件,但我的值是空白的。我的数据库值不会被引号替换。如何在使用标记时将其写入qupte

   <?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);       

&GT;

1 个答案:

答案 0 :(得分:0)

试试这个:

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