php - Using loop for creating row in formatted email -
i want create formatted email. in email's body, need add loop creating table's row. don't know how make work. loop looks
<tbody> <?php $total = 0; for($i=0; $i<3; $i++) { ?> <tr> <td style="padding: 8px; line-height: 20px;">col 0</td> <td>col 1</td> <td>col 2</td> <td>col 3</td> </tr> <?php }?> </tbody>
it works in normal html page. when tried make email's body , pass code string this,
$body = "<tbody> <?php $total = 0; for($k=0; $k<3; $k++) { ?> <tr> <td style='padding: 8px; line-height: 20px;'>1</td> <td>asd</td> <td>ert</td> <td>qwe</td> </tr> <?php }?> </tbody>"; send($to, $subject, $body);
in email, doesn't create row @ all. advice?
main advice learn php syntax.
sample of proper code is:
$body = "<tbody>"; $total = 0; for($k=0; $k<3; $k++) { $body .= "<tr> <td style='padding: 8px; line-height: 20px;'>1</td>" . "<td>asd</td> <td>ert</td> <td>qwe</td> </tr>"; } $body .= "</tbody>"; send($to, $subject, $body)
Comments
Post a Comment