I am very new to php and I have a table that displays cases from our support portal. Cases are set to a priority of “High, Medium, or Low” I want the bgcolor of each row to display a different color based on the priority of that case. For exacmple High = Red, Low = White, Medium = Yellow.
Below is the code I have. How would I go about implementing this? Any suggestions would be greatly appreciated!
<?php
$priority = $val['priority'];
switch($priority)
{
case P3:
$prior_value = "Low";
break;
case P2:
$prior_value = "Medium";
break;
case P1:
$prior_value = "High";
}
?>
<tr height="30px">
<Td class="gridcontentredmid" style="width:65px;"><a href="showcase.php?case_id=<?=$val['id']?>">
<?=$val['case_number']?>
</a></Td>
<Td class="gridcontentmid" style="width:270px; text-align:left;">
<?=$val['name']?></Td>
<Td class="gridcontentmid" style="width:85px;" ><?=$val['status']?></Td>
<Td class="gridcontentmid"><?=$name?></Td>
<Td class="gridcontentmid" style="width:65px;"><?=$prior_value?></Td>
<Td class="gridcontentmidd" style="border-right:#000 1px solid"><?=$date_create?></Td>
</tr>
Just add a
$color-variable to yourswitch, which then can be inserted in theTRsclassorstyleattribute.…