doupingtang9627 2012-06-18 21:14
浏览 17
已采纳

PHP邮件脚本html格式化

someone kindly posted this code for me but it only returns "/table" in the resulting email - any ideas? Does it need a closing html tag?

$mailHeader .= "Content-type: text/html; charset=iso-8859-1
";
$formcontent ="<table border='1'>";
foreach ($_POST as $field=>$value)
{
$formcontent.="<tr>";
$formcontent .= "<td>$field:</td> <td>$value</td>";
$formcontent.="</tr>";
}
$formcontent .= '<tr><td>User-Agent: </td><td>'.$_SERVER['HTTP_USER_AGENT'].'</td>';
$formcontent ="</table>";
  • 写回答

1条回答 默认 最新

  • douyong8801 2012-06-18 21:15
    关注

    The final line is currently:

    $formcontent ="</table>";
    

    It should be:

    $formcontent .="</table>";
    

    Without the dot, it's overwriting the content, rather than concatenating.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?