gamerzfuse Posted May 26, 2009 Share Posted May 26, 2009 To put things simply, I want to change the font color of a value based on the value from the database. Available = 000 Held = 000 Sold = red <?php $vehstatus = $vehicles->status->ViewAttributes(); if ($vehstatus == "Sold"){$statuscolor="red";} if ($vehstatus == "Available"){$statuscolor="000000";} if ($vehstatus == "Held"){$statuscolor="000000";} ?> <tr onMouseover="this.style.backgroundColor='lightblue';" onMouseout="this.style.backgroundColor='transparent';" onclick="document.location='<?php echo $vehicles->ViewUrl() ?>'"; > <?php if ($vehicles->status->Visible) { // status ?> <td<?php echo $vehicles->status->CellAttributes() ?>> <div<?php echo $vehicles->status->ViewAttributes() ?>><font color="<?php echo $statuscolor ?>"><?php echo $vehicles->status->ListViewValue() ?></div> </td> <?php } ?> Any help would be much appreciated, I know it's not right (the if statement part) Link to comment https://forums.phpfreaks.com/topic/159714-solved-font-color-based-on-value-from-database/ Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 You never closed your <font> tag. By the way, <font> tag is deprecated. Use CSS. But as for your error, the $statuscolor with "000000" should be "#000000". Hex format. Link to comment https://forums.phpfreaks.com/topic/159714-solved-font-color-based-on-value-from-database/#findComment-842407 Share on other sites More sharing options...
gamerzfuse Posted May 26, 2009 Author Share Posted May 26, 2009 Unfortunately that doesn't work either. I closed the font tag and changed it to #000000 Right now I am getting a display of black font for all values. Link to comment https://forums.phpfreaks.com/topic/159714-solved-font-color-based-on-value-from-database/#findComment-842422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.