0

I'm trying to figure out how to apply attributes to my table via php email. I can't get the background and and rowspan to work. Can't figure it out.

$to = 'XXXXX';
$subject = 'New Homeless Connection';
$msg = "<html>
<head>
<title>New Homeless Connection</title>
</head>

<body>

<table cellspacing=\"0\" cellpadding=\"10\" border=\"1\" align=\"left\">
<tr>
<td align=\"left\" width=\"150px\" background=\"#EEEEEE\">Registery No.:</td>
<td align=\"left\"> $reg</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">First Name:</td>
<td align=\"left\">$first_name </td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Connection Date:</td>
<td align=\"left\"$>$connect_date</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Probability:</td>
<td align=\"left\"$>$prob</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Volunteer Name:</td>
<td align=\"left\"$><strong>$hv_name</strong></td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Volunteer Phone:</td>
<td align=\"left\"$><strong>$hv_phone</strong></td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Consent Form:</td>
<td align=\"left\"$>$consent</td>
</tr>
<tr>
<td align=\"left\" background=\"#eee\">Field Count:</td>
<td align=\"left\"$>$reg_count</td>
</tr>
<tr>
<td align=\"left\" rowspan=\"2\">http://wwww.41q.org/admin/</td>
</tr>
</table>

</body>
</html>
";
4

2 に答える 2

1

A few things about tables:

  • You don't use "px" to define the width/height. Should just be width="150"
  • The background attribute should be bgcolor, and it doesn't use #. Just set bgcolor="eeeeee"
  • Why do you have $'s like this? <td align=\"left\"$> . Those shouldn't be there.

The rowspan is OK, but it's not doing anything because there is no row below it. I'm not sure what you are trying to do with the rowspan.

于 2012-04-25T15:47:54.317 に答える
0

rowspan should be colspan, as your table has two columns all the way down except for the last row (whose cell needs to span both columns).

Also, background should be bgcolor.

I've posted up a sample with the replacement here: http://jsfiddle.net/8ymMh/4/ The gridlines show the last cell spanning both columns and the background colours come through OK.

I freely admit to have taken onboard AndrewR's suggestion of removing the hash from in front of the colour name (eeeeee) so all credit to him for that.

于 2012-04-25T15:50:50.397 に答える