Not sure if I am doing this correctly or if it is even possible. Basically, I just need to change the background color of a table <td> depending on the value of variable $cascadeType.
In an attempt to make this happen, I tried using $_SESSIONS to store the form input as seen on the following code:
<?php
// starting the session
session_start();
if (isset($_POST['Submit'])) {
$_SESSION['cascadeType'] = $_POST['cascadeType'];
}
?>
Then access the session within the email template (emailtemplate.php) using the code:
<?php
// starting the session
session_start();
?>
Then, within the email template (emailtemplate.php), used the conditional statement below.
<tr>
<?php if ($_SESSION['cascadeType'] = "Information") : ?>
<td style="text-align:center; color:#FFF; background-color:#093; margin:10px; padding:10px 5px;" width="20%">
<h4 style="font-weight:bold;">%cascadeType%</h4>
</td>
<?php elseif ($_SESSION['cascadeType'] = "Update") : ?>
<td style="text-align:center; color:#FFF; background-color:#09F; margin:10px; padding:10px 5px;" width="20%">
<h4 style="font-weight:bold;">%cascadeType%</h4>
</td>
<?php elseif ($_SESSION['cascadeType'] = "Reminder") : ?>
<td style="text-align:center; color:#FFF; background-color:#F00; margin:10px; padding:10px 5px;" width="20%">
<h4 style="font-weight:bold;">%cascadeType%</h4>
</td>
<?php else : ?>
<td style="text-align:center; color:#FFF; background-color:#6C3; margin:10px; padding:10px 5px;" width="20%">
<h4 style="font-weight:bold;">%cascadeType%</h4>
</td>
<?php endif ; ?>
<td style="color:#337AB7; text-align:right; padding-right: 20px;" width="80%">
<h3 style="margin-bottom:2px;">TARGET AUDIENCE</h3>
<p style="margin-top:2px;">%targetAudience%</p>
</td>
The email output just displays all table <td> and apparently does not work. Please advise on what is the best way to approach the situation if conditional statements will really not work within an email template
Aucun commentaire:
Enregistrer un commentaire