Hi to all I am trying to perform a basic stock calculation. What I want to do is show the result in green if the amount is positive, red if the amount is negative <td width="53" align="center" ><font size=2><?php print ($product_info['products_sydstock'] - $product_info['products_sydcommit']); ?></font></td> PHP: If the result of the above is "-4" then I want that displayed in red(using HTML tags I presume) if the result is "99" then I want that in green. The idea is to make it easy for end users to see if something is in stock (green means GO, red means STOP) sort of mentality. Any help is much appreciated.
not sure what your variables are, but if ($variable>=0) { echo '<font color="green"> text </a>' } else if ($variable<0) { echo '<font color="red"> text</a> } PHP: or you can escape from php and just do it
<?php $variable = $product_info['products_sydstock'] - $product_info['products_sydcommit']; ?> <td width="53" align="center" ><font size="2" color="<?php echo ($variable <= 0 ? "red" : "green");?>"><?=$variable;?></font></td> PHP: Peace,