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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -