dpwgzi7987 2013-08-08 13:59
浏览 20

在php变量中存储HTML表格?

i want to use to html table in a php variable so that i can use that variable in php mail and that mail should renders the html table. I used EOD but its not working. Here is the code i'm using which is not working.

$body1 = <<<EOD
     <br><br>
      <h3 align="center">Career Details</h3>
      <table border="1" width="100%">  
        <col width="50%">
        <col width="50%">
        <tr>
            <td style="text-align:left;">Name: $nameField </td>
            <td style="text-align:left;">Email: $emailField </td>
        </tr>
        <tr>
            <td style="text-align:left;">Date of Birth: $dob</td>
            <td style="text-align:left;">Passport Number: $passportnum</td>
        <tr>
            <td style="text-align:left;">Gender: $gender</td>
            <td style="text-align:left;">Nation: $nation</td>
        <tr>
            <td style="text-align:left;">Phone: $phone</td>
            <td style="text-align:left;">Prefered Location: $location</td>
        <tr>
            <td style="text-align:left;">Area of Interest: $areaofinterest</td>
    </table>
    EOD;


  $body=$body1;
  $headers = 'From: noreply@mydomain.com';
  if(mail($mailto, $emailSubject, $body, $headers)){
     header ('Location: http://www.mydomain.net?page_id=664');
}
  • 写回答

3条回答 默认 最新

  • douzhao6584 2013-08-08 14:02
    关注

    The space before EOD;. It needs to be on its own line, without any space before it. Example:

    $body1 = <<<EOD
    yourstuff
    EOD; // Note that there is no space before EOD;.
    
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么