简体   繁体   English

如何使用PHP邮件功能发送带有从后端到邮件的数据的申请表

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

my form structure go to the mail but my values are blank.My database values does not get replaced in quotes.How to write it inside qupte when i am using tag 我的表单结构转到邮件中,但我的值是空白。我的数据库值未替换为引号。当我使用标签时如何在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);       

?> ?>

Try this : 尝试这个 :

$to = $rows[0]['email']; because you are using mysql_fetch_array 因为您正在使用mysql_fetch_array

and change this because you are using the php session 并更改它,因为您正在使用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>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM