Jimbly2
Jimbly2

Reputation: 227

PHP mail script html formatting

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\r\n";
$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>";

Upvotes: 0

Views: 197

Answers (1)

andrewsi
andrewsi

Reputation: 10732

The final line is currently:

$formcontent ="</table>";

It should be:

$formcontent .="</table>";

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

Upvotes: 5

Related Questions