vendredi 31 janvier 2020

If condition in mail body phpmailer

I am using Phpmailer and I am currently emailing the data from my database. However, I need to have a color coding depending on the chosen condition. For example, if the remarks is proceed, the data cell should be in green color and red if hold. Im not really sure how to apply if loop inside an echo. Please help

while ($rowwaf = mysqli_fetch_assoc($queryres)){
$mailbody = "
        Good Day!<br><br>
        Please see details below<br><br>
        <strong>Details:</strong><br><br>
        <table class=\"table\" cellpadding=\"5\" rules=\"all\" frame=\"box\" border=\"1\">
                        
                        <tr><td class=\"data\"><strong>REQUEST DATE:</strong></td><td>".$rowwaf["req_date"]."</td></tr>
                        <tr><td class=\"data\"><strong>ISSUE ENCOUNTERED:</strong></td><td>".$rowwaf["issue"]."</td></tr>       
                        <tr><td class=\"data\"><strong>URGENCY:</strong> </td><td>".$rowwaf["urgency"]."</td></tr>
                        <tr><td class=\"data\"><strong>REQUESTOR:</strong></td><td>".$rowwaf["requestor"]."</td></tr>
    <tr><td class=\"data\"><strong>REMARKS:</strong></td>
    
    -- if condition sample--
    if {
    $rowwaf["remarks"] == proceed
    <td style="color: green">".$rowwaf["remarks"]."</td></tr>
    }
    else {
    $rowwaf["remarks"] == hold
    <td style="color: red">".$rowwaf["remarks"]."</td></tr>
    }
        ";      
                

Aucun commentaire:

Enregistrer un commentaire